8

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).

Community
  • 1
  • 1
TooTone
  • 7,129
  • 5
  • 34
  • 60
  • possibly related: http://stackoverflow.com/questions/2530864/gcc-precompiled-headers-weird-behaviour-with-c-option – TooTone Jul 06 '15 at 15:53
  • 1
    The patch from http://lists.samba.org/archive/distcc/attachments/20080604/caa48a15/distcc-2.18.3-pch.diff-0001.obj - https://lists.samba.org/archive/distcc/2008q2/003646.html was not integrated. There was "src/pch.h" in the patch and there is no pch in recent distcc: https://github.com/distcc/distcc/tree/master/src the only word pch in distcc is web/distcc-lca-2004.html " At the moment distcc can support this by putting the `.pch` state file on a shared filesystem." Check also https://lists.samba.org/archive/distcc/2009q1/003895.html "Precompiled headers support status" 2009. – osgx Jul 12 '16 at 01:02
  • 1
    Apple had some kind of precompiled headers integration in their fork of older distcc 2.18: https://opensource.apple.com/source/distcc/distcc-2805/distcc.README "As of 3.1.2, Xcode bundles a fork of an older version of distcc, 2.18.5-Apple.1. Apple distcc has several changes ... precompiled header support" – osgx Jul 12 '16 at 01:06
  • 1
    Nowadays distcc nodes can themselves compile the headers. So not exactly precompiled, but the load can be spread out on more nodes. They call it *pump* mode. – Prof. Falken Jan 17 '18 at 10:55

0 Answers0