[Development] Precompiled headers enabled for most modules (if you enabled precompiled headers)

Milian Wolff milian.wolff at kdab.com
Tue Jul 15 15:32:10 CEST 2014

On Tuesday 27 May 2014 14:21:40 Thiago Macieira wrote:
> Hello
> This is your friendly note that all Qt modules that don't have C or assembly
> code are now using precompiled headers. I've tested this solution for a
> couple of months with GCC on Linux, Clang on Linux, Clang on Mac and the
> Intel compiler on Linux.
> As it turns out, I didn't test it in all modules with Visual Studio. I've
> just fixed one problem in QtScript and we have one left in qtlocation for
> QtLocation which makes no sense to me and I can't reproduce.
> This change does *not* enable precompiled headers by default. You still need
> to pass -pch to the configure script or to configure.exe in order to get
> them. It simply creates a precompiled header for the modules that didn't
> previously define one, unless explicitly overridden.
> When you should override:
>  - when you have C, Objective C (not Objective C++) or assembly sources
>    [done for all current modules]
>  - when you need to do ugl^H^H^Hclever hacks with preprocessing that not
> even NO_PCH_SOURCES can help
>    [no known instance]
>  - when you have a better precompilation source than the default

Hey Thiago,

I have an issue with PCH's. I do not pass the -pch flag to configure, yet 
still I regularly get build errors like the following, even on clean builds:

In file included from <command-line>:0:0:
/usr/include/stdc-predef.h:59:1: error: one or more PCH files were found, but 
they were invalid
/usr/include/stdc-predef.h:59:1: error: use -Winvalid-pch for more information
/usr/include/stdc-predef.h:59:1: fatal error: .pch/Qt5Quick: No such file or 
compilation terminated.

The above is from QtDeclarative (dev branch), but I've also seen it in QtBase 
and QtXMLPatterns, even while doing "make install" after a successful make... 
It seems to be related to the number of jobs running, a "make -j1" seems to 
work most of the time, yet a "make -j40" on a compile cluster fails most of 
the time. It is pretty random, as it fails on different files across rebuilds. 
I guess, if I'd run a make in a for loop until if finished successfully it 
might work eventually but of course that is not an option.

I'm now trying to explicitly disable pch with -no-pch in QtBase and see 
whether that makes a difference. Considering that I did not pass -pch before, 
I wonder if it makes any difference...

Did anyone ever see such an issue? What am I doing wrong? I'm building Qt5 dev 
branches with gcc 4.9.0 over icecream on an up2date ArchLinux system.


Qt Developer Days 2014 - October 6 - 8 at BCC, Berlin

Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions

More information about the Development mailing list