aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-i’ - c++

I use this command->
aarch64-linux-gnu-gcc -i ok.c
to see the output of the prepossesses file
But it gives me error->
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-i’
I use both native and cross compiler(gcc and aarch64-linux-gnu) but both produces same result, the --help command show where there is no -i command at any compiler,
I find this command in "Advanced C and C++ Compiling - 2014 by Milan Stevanovic" book.
My os is Ubuntu - 20.04.2 LTS
Compiler version : gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 and
aarch64-linux-gnu-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

Related

configure: error: Fortran compiler cannot create executables

I'm trying to install Quantum ESPRESSO on my computer and have run into an issue when using the ./configure command in the unpacked directory.
$ ./configure
checking build system type... x86_64-apple-darwin21.2.0
checking ARCH... mac686
checking setting AR... ... ar
checking setting ARFLAGS... ... ruv
checking for gfortran... gfortran
checking whether the Fortran compiler works... no
configure: error: in `/Users/myname/winter/q-e-qe-6.8':
configure: error: Fortran compiler cannot create executables
See `config.log' for more details
I just updated to macOS Monterey and have GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0 installed.
When trying to debug this, I looked at the config.log file and looked at similar googled questions. They all point me to updating or reinstalling things, like gcc, which I subsequently did.
Does the problem have to do with this:
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I can see that the version is 4.2.1, but I'm unaware of what Apple clang is. Is it a PATH issue?
I'd appreciate any help.
P.S. Please choose to be kind in responses.
Here is part of the config.log:
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0_3)
configure:2542: $? = 0
configure:2531: gfortran -V >&5
gfortran: error: unrecognized command-line option '-V'
gfortran: fatal error: no input files
compilation terminated.
configure:2542: $? = 1
configure:2531: gfortran -qversion >&5
gfortran: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gfortran: fatal error: no input files
compilation terminated.
configure:2542: $? = 1
configure:2557: checking whether the Fortran compiler works
configure:2579: gfortran conftest.f >&5
clang: error: invalid version number in '-mmacosx-version-min=12.1'
configure:2583: $? = 1
configure:2621: result: no
configure: failed program was:
| program main
For reference:
$ gfortran --version
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```
I had the same issue and I solved by doing the following:
Removing the old tools
($ sudo rm -rf /Library/Developer/CommandLineTools).
Installing xcode command line tools again
($ xcode-select --install).
It was retrieved from:
How to update Xcode from command line

How to enable later versions of GCC in eclipse CDT in CentOS 7

My CentOS 7 machine has a default GCC version of 4.8.5. I want to use a higher version of GCC. So, I executed the following steps in a terminal:
sudo yum install centos-release-scl
sudo yum install devtoolset-10-gcc*
scl enable devtoolset-10 bash
After performing the steps, my GCC is now 10.2.1. I then launched Eclipse CDT (10.2.0) through the terminal. Upon enabling C++20 in Eclipse, I tried to compile a simple "hello world" code, but I received the following error in the Eclipse console:
g++ -std=c++2a -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/dummy2.d" -MT"src/dummy2.o" -o "src/dummy2.o" "../src/dummy2.cpp"
g++: error: unrecognized command line option ‘-std=c++2a’
make: *** [src/dummy2.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
My system PATH variable has the following directory as its first entry: /opt/rh/devtoolset-10/root/usr/bin. So, I don't know why my Eclipse is still using the old GCC 4.8.5. How do I adjust my Eclipse settings so that I am able to compile higher versions of C++ in CentOS 7?

cross-compile opencv for arm : c++: error: unrecognized command line option ‘-mthumb’; did you mean ‘-mtbm’?

I am trying to cross-compile opencv 4.0/3.4 for a Tinker Board - ARM-based processor — the Rockchip RK3288
I am using Ubuntu 18.04 as host machine.
I pretty much followed everything mentioned here.
But when I try the cmake using below:
mike#mike-laptop:~/opencv-3.4.5/build$ cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake ../ I am getting the below error:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: /usr/bin/c++ Build flags: -mthumb;;-fdata-sections;-Wa,--noexecstack;-fsigned-char;-Wno-psabi Id flags:
The output was: 1 c++: error: unrecognized command line option ‘-mthumb’; did you mean ‘-mtbm’?
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: /usr/bin/c++ Build flags: -mthumb;;-fdata-sections;-Wa,--noexecstack;-fsigned-char;-Wno-psabi Id flags: -c
The output was: 1 c++: error: unrecognized command line option ‘-mthumb’; did you mean ‘-mtbm’?
and tons of more messages
I had met the same problem. I try
sudo apt-get install g++-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabihf
and I solve it.
I hope it will help you!

CUDA 7.0 complains about not supporting gcc 4.9

I have installed gcc-4.7, gcc-4.8, gcc-4.9
When I try to do:
luarocks install cutorch
I get an error:
In file included from /usr/include/cuda_runtime.h:59:0,
from <command-line>:0:
/usr/include/host_config.h:82:2: error: #error -- unsupported GNU version! gcc 4.9 and up are not supported!
#error -- unsupported GNU version! gcc 4.9 and up are not supported!
I found a similar problem
But when I try to run the command:
nvcc --compiler-bindir /usr/bin/gcc-4.7
I get an error:
nvcc fatal: No input files specified; use option --help for more information
I'm new and installed linux day ago. Please help me
Run the following commands before the installation:
export CXX=/usr/bin/g++-4.8
export CC=/usr/bin/gcc-4.8
this should set the compiler to gcc-4.8 for the compilation.

msys and tdm-gcc: configure error - cannot run C compiled programs

so I'm trying to compile a preexisting C++ project with msys and tdm-gcc in Windows. I have done this successfully by installing tdm-gcc (latest version) via the installer, editing MinGW/msys/1.0/etc/fstab to give my tdm-gcc install as the mount location, then running msys to call the configure script, and make.
However, for this project I need to use an old version of tdm-gcc (4.6.1-tdm64-1) for binary compatibility. So I installed the required packages from the tdm-gcc sourceforge site (gcc core, gcc c++, binutils, mingw64-runtime, mingw32-make, libintl, libiconv, all of the version the readme says to use with 4.6.1), extracted to a new directory, and edited fstab to point to their location. Now while executing the configure I get this error: cannot run C compiled programs. The config file reads:
[omitted]
configure:3436: $? = 0
configure:3425: gcc -v >&5
Using built-in specs.
COLLECT_GCC=c:\TDM-GCC-4.6.1-64\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/tdm-gcc-4.6.1-64/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.1/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../src/gcc-4.6.1/configure --build=x86_64-w64-mingw32 --enable- targets=all --enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp --enable-lto --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-fully-dynamic-string --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.6.1 (tdm64-1)
configure:3436: $? = 0
configure:3425: gcc -V >&5
gcc.exe: error: unrecognized option '-V'
gcc.exe: fatal error: no input files
compilation terminated.
configure:3436: $? = 1
configure:3425: gcc -qversion >&5
gcc.exe: error: unrecognized option '-qversion'
gcc.exe: fatal error: no input files
compilation terminated.
configure:3436: $? = 1
configure:3456: checking whether the C compiler works
configure:3478: gcc conftest.c >&5
configure:3482: $? = 0
configure:3530: result: yes
configure:3533: checking for C compiler default output file name
configure:3535: result: a.exe
configure:3541: checking for suffix of executables
configure:3548: gcc -o conftest.exe conftest.c >&5
configure:3552: $? = 0
configure:3574: result: .exe
configure:3596: checking whether we are cross compiling
configure:3604: gcc -o conftest.exe conftest.c >&5
configure:3608: $? = 0
configure:3615: ./conftest.exe
./configure: line 3617: ./conftest.exe: Bad file number
configure:3619: $? = 126
configure:3626: error: in `/c/jagswm':
configure:3628: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
[omitted]
I've tried adding the tdm-gcc bin to my path, although I don't think that should matter if fstab is set.
Any advice would be greatly appreciated, thanks.
Try to disable your antivirus.
Worked for me while compiling GStreamer, probably because Avast was deleting the a.exe file.
Source: http://wiki.openttd.org/Compiling_on_Windows_using_MinGW#Compilation_and_installation_of_the_required_packages