I use the Clear Linux distro (made by Intel) to build some C++ project that uses CMake. I run cmake
and than make
commands. When the make
builds the code there is some warning about maybe-uninitialized
and that warning is treated as an error, because the C++ compiler has been ran with a -Werror
option. Currently I can't figure out where that -Werror
option was added from. Please help me to find.
I've found that the default value of the CXXFLAGS
environment variable in Clear Linux is stored at /usr/share/defaults/etc/profile
as following:
CFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now
-Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=sk
ylake -Wa,-mbranches-within-32B-boundaries"
FFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
size=32 -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -malign-d
ata=abi -fno-semantic-interposition -ftree-vectorize -ftree-loop-vectorize -Wl,--enable-new-dtags -Wa,-mbranches-within-32B-boundari
es "
FCFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer
-size=32 -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -malign-
data=abi -fno-semantic-interposition -ftree-vectorize -ftree-loop-vectorize -Wl,-sort-common -Wl,--enable-new-dtags "
CXXFLAGS="$CFLAGS -fvisibility-inlines-hidden -Wl,--enable-new-dtags "
As you can see it doesn't contain the -Werror
option yet.
Another location, where the CXXFLAGS could be overriden is /etc/profile
but it doesn't exist. Local user's ~/.profile
and ~/.bashrc
also don't override the CXXFLAGS
.
So where CMake appends additional CXXFLAGS from? Does it have some built-in additions for the CXXFLAGS
?
I'm pretty sure they don't come from the project itself because otherwise that project developers were also not able to build their code. Also I experienced the same issue when tried to build glibc according to instructions of Linux From Scratch. Could it be something specified to the Clear Linux distro that I use? But I'm doubt Intel has fixed all warnings in all C/C++ code their distro use.