User forums > Help
LLVM Clang precompiled headers Code::Blocks 20.03
camilocc:
Hi Dear Code::Blocks Team,
I had just built Code::Blocks 20.03 for CentOS 8.1 .
I realized I cannot build large project in fair amount of time because cannot use precompiled headers with GCC at EL8 (CentOS 8 ). The EL8 hardened build requirement prevent GCC from using precompiled headers due to its precompiled header strategy - it relies on fixed addresses which is incompatible with PIE (Position independent Executable) build.
So I am giving a try on using LLVM Clang compiler on Linux, initially just at CentOS 8.
I am trying to build a simple project to test precompiled headers with LLVM Clang Compiler.
I selected the precompiled header strategy of putting the precompiled header next to the original header.
The precompiled header is never generated. I tried other precompiled headers strategy and it is not generated either.
As workaround, tried to use custom build for the framework.h header file with -emit-pch Clang option.
I selected Build File on File properties and set build priority to 0.
It still doesn't build the header.
I could put -include-pch framework.h.pch at Compiler Options for the entire project.
It throws error that precompiled header doesn't exist.
Am I doing something wrong?
Does Code::Blocks implement precompiled headers for LLVM Clang compiler?
Best regards,
Camilo
stahta01:
Did you set the file property of the PCH file to be compiled?
PCH means Precompiled header
Edit: I have never used LLVM/CLang to compile a header; it might not work.
Edit2: I am downloading .5 gigs to see if it works on Windows under MSys2 64 bit
Tim S.
oBFusCATed:
--- Quote from: camilocc on April 13, 2020, 01:36:22 pm ---The EL8 hardened build requirement prevent GCC from using precompiled headers due to its precompiled header strategy - it relies on fixed addresses which is incompatible with PIE (Position independent Executable) build.
--- End quote ---
What do you mean? You can pass an option to disable PIE with a compiler/linker option. Wouldn't this work? If GCC is broken why would clang work?
I'm not sure if anyone has tested PCH for clang, I suppose they are broken, you could probably inspect the various compiler related xml files to see if there is something missing in the ones for llvm.
And clang is not really efficient with pch - https://randomascii.wordpress.com/2020/03/30/big-project-build-times-chromium/ :) Next thing to try is the unity-build craze. :)
stahta01:
https://clang.llvm.org/docs/PCHInternals.html#using-precompiled-headers-with-clang
I think you will find that C::B does not support PCH using the clang compiler.
But, if you put the PCH into a separate target you should be able to add the pch option to it.
Tim S.
camilocc:
Hi obfuscated,
I think clang doesn't have problems with EL8 (PIE compilation). GCC certainly cannot make currently make their precompiled header work at EL8, because of hardened builds with PIE. The header precompiling in GCC uses functions fixed addresses which implementation gets broken with PIE builds.
https://bugzilla.redhat.com/show_bug.cgi?id=1721553
Best regards,
Camilo
Navigation
[0] Message Index
[#] Next page
Go to full version