The default value of CFLAGS & CXXFLAGS may cause compile error

As we know, some compile options such as CFLAGS & CXXFLAGS are set in /usr/share/defaults/etc/profile. These options may cause compile errors. I’d like to know why these options are set as default.


Without knowing what compile errors you are getting, this argument is somewhat baseless. The compile settings that ClearLinux uses are used for all the ClearLinux packages, so we test and use them extensively on thousands of packages! Now, there are some that need some tweaks, but that is relatively normal and every Linux distribution needs to deal with this.

Please explain what compiler errors you are getting. And, we’d need to know what project is giving the compile errors.

Second, aside that, it’s entirely reasonable and possible you want to choose other CFLAGS. All you need to do is modify ~/.bashrc and provide your own preferred values. You may for instance want to compile for an older system, so that’s entirely possible.

If you’re using Clang, let us know too.

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 -Wl,–copy-dt-needed-entries -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-signed-zeros -fno-trapping-math -fassociative-math -Wl,-sort-common -Wl,–enable-new-dtags -mtune=skylake"

Can this part “-Wl,-z -Wl,now -Wl,-z -Wl,relro” be changed to “-Wl,-z,now,-z,relro”?