I have a large project for which I've implemented precompiled headers. I'd also like to be able to get it to work with distcc. According to section 4.12 in the google code paper here
gcc version 3.3 includes some performance improvements that make distcc less immediately useful.
One is precompiled headers, whereby the internal state of the compiler is dumped out to disk after reading a set of common header files. This is useful for programs that include a large and fixed set of headers, where parsing the headers takes a large fraction of the compile time. At the moment distcc can support this by putting the .pch state file on a shared filesystem. A better solution may be added to distcc in the future.
I don't think using a shared filesystem is a good solution for me. But there are also later mentions of a potential patch to get precompiled headers and distcc working together in a better way: https://lists.samba.org/archive/distcc/2008q2/003646.html. This would involve setting DISTCC_PCH
on the client (or using the compiler option -fpch-preprocess
, see here), and adding the pch
option to the DISTCC_HOSTS
for the servers. I've tried this but it doesn't seem to work so I suspect the patch wasn't integrated.
Is there any support for precompiled headers in distcc over and above a shared file system? Or any reasonably straightforward way of getting the technologies to cooperate?
Update: I now have a situation where I use precompiled headers compilation for a local build and for a distcc build I force include the precompiled header files so that local and distcc builds both compile exactly the same source. With a careful choice of precompiled headers I can get a local debug build to be about 40% faster than it was before and a distcc build is only about 4% slower. What I'd like it to somehow marry precompiled headers and distcc to get a speedup, say 10 or 20%, with distcc builds, with a fairly small amount of effort and intrusiveness (speeding up builds is not my primary responsibility and besides in a corporate environment I'm limited in what I can do).