[distcc] PCH Headers and distcc (again!)

Jamie Kirkpatrick jkp at kirkconsulting.co.uk
Sun May 25 15:47:37 GMT 2008


Hi all

This topic hasn't be raised for some time, but having spent a whole weekend
playing with distcc, only to be massively disappointed by this stumbling
block, I think its worth revisting.

I spent a couple of days setting up various cross-compilers etc on the boxes
I have at home to see if I couldn't get some kind of compiler farm on the
go.  After much playing around I finally got it all running, but then spent
a further day trying to work out why I could not get distcc to improve my
compile times at all.

In the end the answer turned out to be that I was using PCH headers which
are disabled by the flags used to preprocess code by distcc.  Bummer.  So
next I tried to see if I could get the two to play nice together.  There is
a suggestion in an earlier post that one should use the "-fpch-preprocess"
flag to force the inclusion of a special pragma that tells GCC how to use
the PCH header.  The problem, as also previously noted, is that the flag
tells GCC to include the PCH file when dealing with the preprocessed code.
Only the PCH header is not on the target machine.

I wasn't going to give up there however.  I know from reading elsewhere that
Apple allow the use of PCH headers in combination with distcc and I wanted
to know how.  So, after some time spent poring over their modified version
of distcc, as well as the GCC code I know how.

They have altered distcc to transfer the PCH headers to the target machine,
and then in turn taught GCC how to read the files from special temporary
locations.  The solution allows you ot get the benefits of PCH headers as
well as using distcc.

The question I have is whether or not we can find some way to integrate the
code that does the transfering, and find some other way to get GCC to read
the files?  This would be of massive benefit to projects where PCH files are
in use already, and the idea of switching away to use distcc does not
appeal.

The only other snag I've hit is that GCC does some checksumming of the PCH
files, working out if they are compiled with the same version, which means
you need *exactly* the same binary as the system that compiled it.  Again,
not ideal but workable for those that need it.

Thoughts would be welcome.  I spent a long time getting to this point and it
seems a shame to let my findings go to waste: most of the code for a fix is
already written so it would make sense to use it.

-- 
Jamie Kirkpatrick
07818 422311
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the distcc mailing list