I am trying to compile my project via clang++, version 3.4. I am using flag -std=gnu++11, and it fails.
Earlier I used llvm 3.3 and everything was OK. but now i have such error message:
clang (LLVM option parsing): Unknown command line argument '-std=gnu++11'. Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-stats=gnu++11'?
Testing shows that this error can come up when some other bogus options get used. For example:
$ clang -mllvm -std=gnu++11 test3.cc -o test3
clang (LLVM option parsing): Unknown command line argument '-std=gnu++11'. Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Did you mean '-stats=gnu++11'?
The -mllvm option tells clang to not process the -std=gnu++11 option itself, but to pass it on to LLVM. But LLVM has no idea what this option means.
To solve the problem, make sure your other options are correct; the error message is leading you to think the problem is somewhere it isn't.
Related
I am trying to configure the last version of clang (6.0) to use the arm-none-eabi linker instead of the ld.lld but clang is always ignoring everything and keep asking for the ld.lld one. I am trying to build for cortex-m3 (lpx1769 board). How do I force clang to use the linker I want.
-fuse-ld=ld is also not working, so does clang no longer allow the use of any other linker?
So the answer was to use the flag:
-fuse-ld=path/to/linker-to-be-used
Remember that if you passing this flag to clang it will cause a warning that clang will not use this flag (only the linker stage will do). Thus if you compiling with -Werror, the warning will be turned into an error.
Moreover, because you are cross-compiling probably you will need to let the linker know where to find the target-specific libraries needed using the -L option. See this for more info:
https://clang.llvm.org/docs/CrossCompilation.html
I have an powerpc cross compiled gcc tool chain of version 3.4.3
I am getting certain error for options which are not supported by this compiler like (unrecognized command line option "-Wno-pointer-sign")
Is there a way i can print all supported compiler option for this gcc version. I dont have source code for this.
You can use gcc --help=warnings to get the full list of supported -Wsomething options. Regarding the rest, there're gcc --help=common, gcc --help=params etc, check gcc --help output
I would like to test an older version of gcc for my program, so how can i change the version used for compilation ?
Is there a way to change it directly in the command line ?
(ex: gcc -blabla -o main main.c)
Cheers
Aurel
Are you on a debian-based distro? When I type gcc and hit tab I get other options gcc-4.4 gcc-4.6 gcc-4.8 gcc-4.9 etc - just substitute gcc for gcc-4.6
I'm trying to compile and install the x264 H.264/AVC encoder.
I've got gcc installed. But I get the 'No working C compiler found' error when I run:
./configure --enable-shared --enable-static
What can I do?
The config log said:
/bin/gcc conftest.c -Wall -I. -I$(SRCPATH) -falign-loops=16 -mdynamic-no-pic -o conftest
clang: error: unknown argument: '-falign-loops=16' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
I encountered the same error and found a simple solution here:
http://www.xin.at/x264/x264-guide-macosx-en.htm
Before actually being able to start the build we will however need to remove a GCC compiler flag from the configure script, that the newer LLVM+CLANG compiler will not be able to handle. For that, please open the file configure in your favorite text editor and look for the following spot:
darwin*)
SYS="MACOSX"
CFLAGS="$CFLAGS -falign-loops=16"
Replace that with the following, effectively removing the -falign-loops=16 option:
darwin*)
SYS="MACOSX"
CFLAGS="$CFLAGS"
After doing the above, libx264 builds just fine :)
The configure script is trying to set a compiler option -falign-loops=16 that the clang compiler (masquerading as gcc) declines to accept.
Either get (compile) your own real GCC and use that (I've done the compilation and installation; it's not very hard, though neither is it trivial), or work out how to stop the configure script from failing simply because it assumes that the -falign-loops=16 option must be supported by all versions of GCC. That is the sort of thing the configure script should be checking so that you don't run into that sort of failure. Ultimately, this is a bug in the configuration for this code.
I want to generate the assembly file of my code oriented to the AVR architecture, I am using gcc version 4.7.2 with the following arguments:
g++ -O3 -Wall -S -Wp,-mmcu=atmega8 -o "src\Compression.o" "..\src\Compression.cpp"
but I am getting the following error:
cc1plus.exe: error: unrecognized command line option '-mmcu=atmega8'
But I got the command options from the gcc website:
http://gcc.gnu.org/onlinedocs/gcc-4.7.3/gcc/AVR-Options.html#AVR-Options
There should be something that I am missing, could you help me with this please!
If gcc does not accept -mmcu, you are probably not using a gcc with support for the AVR architecture.
It's normally used like this:
avr-gcc -mmcu=atmega328p
because it's not only the preprocessor, it's actually other tools as well which require this setting (linker, assembler).
Normally the architecture gcc is compiled for is indicated by a prefix, in this case it's avr- by convention.
So the solution is to get a toolchain with AVR support. You can download it from Atmel's web site, even for Linux.
Update
If you like to check the configuration of your gcc, you can use -dumpmachine to check for the target processor
$ gcc -dumpmachine
i486-linux-gnu
$ arm-none-eabi-gcc -dumpmachine
arm-none-eabi
$ avr-gcc -dumpmachine
avr
If you look at the target specific options using --target-help
$ gcc --target-help | grep march
-march= Generate code for given CPU
you can see that the Linux gcc does accept -march as well. It probably fails later.
gcc is a very complex piece of software, because it just supports so many different architectures. From that perspective it works amazingly well.
Another interesting option is -v
$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8'
[...]
to see how that gcc has been built.
And there could be another trap down the road (multi-libs), as you can see here