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.
Thanks!
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.
Thanks!
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”?
Doesn’t it sound at the very least a bit weird having arguably the 2 most important make flags globally defined by default? Sure you can overwrite/unset them, but it sounds weird to me. Kinda feels like someone’s unfinished work, or some development stage setting that wasn’t supposed to be in production, or that every CLOS user is also a CLOS dev. I’m unironically sure you guys have a very good reason for it. I’ll just have to get used to it.
We do this so that every user compiling software benefits from the optimizations that are available to them. It’s self-evident that there is a lot of value in doing that.
Even non C/C++ developers need to compile things with GCC quite often. For example, most R packages are written in C/C++ even though majority of R users don’t write these two languages. I observe significant performance gains on Clear Linux.
Building from source is about control. Convenience comes after it, not before. Having those flags set is the opposite of that.
Anyway, it’s more of a philosophical point rather than a practical one. I won’t make a stand on this.
Just a minor note here, I think the default CFLAGS/CXXFLAGS are potentially causing breakage with Pytorch master. Certain functions are supposed to be compiled are missing when examined with nm
causing a linking error, not occuring with Pytorch 1.4.0, so it is certainly possible something they are doing that is triggering this problematic behavior.
Not being super-expert about compilers, having CFLAGS already set saved me a lot of time and got me with super-performant programs, I just had to add -march=native and was good to go. Also, I wonder what developer doesn’t set CFLAGS at all… Finally, if you want to use your personal CFLAGS, having them default to empty or to a preset doesn’t change anything in how you put your personal values!