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
Related
I have a cc_library (tbb) that requires the compiler flag -mwaitpkg on some compilers (Clang) to compile successfully. At the same time, there are older versions of GCC (4.9) that do not know this flag, and therefore the compilation via GCC 4.9 leads to an error:
gcc: error: unrecognized command line option '-mwaitpkg'
In a more advanced Bazel setup, I guess one would work around this using hermetic toolchains. This way every toolchain could provide its own set of compiler flags. Nevertheless, I do not want to enforce any specific toolchain and I am not sure if this is the right way to go (move copts to toolchain?).
Also introducing a config would be a way to solve this problem. E.g. bazel build --config=waitpkg //.... But this would require that a user is aware of this config and also knows the details of using waitpkg.
What is a proper "Bazel-way" to handle different compiler flags for different compilers?
The flag '-mwaitpkg' is supported by GCC version 9.3, Clang* 12, and newer versions of those tools.
If you build Bazel with earlier versions of GCC, you should remove the flag otherwise it gives compilation errors.
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
When building gcc 5.1 from source, the configure script lists the following option:
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
What does this mean? Is it telling gcc to use gold as the linker if gold is installed on the box ? If so, does it expect gold to be the default linker or should I point to gold via the
--with-ld=<path/to/linker>
option?
I could not find a reference to --enable-gold in the online gcc configure docs.
Thanks!
GCC shares its top-level configure script with some other GNU projects, notably Binutils and GDB.
--enable-gold is an option for Binutils, which says to build the Gold linker as well as the older BFD linker. The option has absolutely no effect when building GCC.
In java, there is command line option javac -version to know the version that is installed on computer. I am curious to know about is there any way exist to know the version of gcc or any command line option that can help me?
Remember I am not asking about language standards like C99, C11, C++11 etc. I am asking about compiler version like gcc 4.9.2 etc.
In order to get that information you should type the commands: gcc -v or gcc --version. For more details see the man pages for gcc http://linux.die.net/man/1/gcc
Where can I find a list of all available warning and error flags I can set in clang and gcc? I've looked all over both of their respective documentation sites, and I can't find anything.
gcc --help=warnings,seperate
gcc --help=warnings,joined
gcc --help=warnings,undocumented
gcc --help=warnings
seperate flags are like boolean values; they are either on or off.
-Wflag means on. -Wno-flag means off.
joined flags are flags that require a value.
-Wflag=value
by typing gcc --help=warnings you will recieve all the warning options provided by your compiler.
EDIT:
looking at GNU Documentation, these warnings messages have existed since GCC 4.3.6
GCC: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html#Option-Summary.
For Clang, there is -Weverything, which enables all warning flags.
The classic: man gcc. clang's manpage is not that populated yet, but since it mimics gcc's behavior anyway, many of gcc's -W options also work with clang.
If the question is just to find the list of all possible GCC diagnostic (error, warning, ...) messages, you could use the catalog of messages for localization utilities. With the GCC source tar ball, look inside gcc/po/ or libcpp/po/ or libstdc++-v3/po/ etc.
If you just ask about the options used to get these messages, follow the link in the answer by Oli Charlesworth