[distcc] Preprocessed output to make's stdout instead of to remote distccd

Terry Griffin terryg at axian.com
Mon Oct 7 23:01:00 GMT 2002


Martin Pool wrote:
> On  2 Oct 2002, Terry Griffin <terryg at axian.com> wrote:
>> > Building distcc using distcc works OK for me.  What version of gcc
>> are you using?
>>
>> For building distcc I was using Red Hat's gcc 2.96 (not an official
>> GNU release). For the clients project it's gcc 3.0.4.
>
> I wonder if Red Hat did something wierd to their version to make it
> behave differently to both earlier and later GNU versions?
>
I wouldn't have been surprised if it was just 2.96 except that the
gcc 3.0.4 that comes with RH 7.2 is pretty much right off the GNU shelf
as far as I know, and it has the same behavior.

> At the moment I can't what can be done to make it work.  If you want to
> use that (buggy?) compiler, you will need to leave off -MD.
>
Not an attractive option. If I do that then I need another invocation of
the compiler with -M just to generate the .d files. That extra invocation
wipes out much of the gains from using distcc in the first place.

> If what you're saying is correct, then we can't know what will go into
> the -o output file when one of the -MD options is used.  We can't just
> remove the -MD option from the preprocessor invocation, because that
> needs to happen as part of preprocessing to have the right side
> effect.  We also can't just leave off the -E, because then the
> compiler will run locally.
>
>> I'm assuming it would have been an object file instead of preprocessed
>> output, but -E suppressed object output so it doesn't really matter.
>
> It's not really accurate to say -E suppresses object output.  What it
> actually does is suppress running the compiler.  So -o with -E always
> specifies the preprocessor output.
>
>> >> Since -o is meant for the object file when -MM or -MMD are used,
>> preprocessed output is sent to stdout.
>> >
>> > Why do you say that?
>>
>> Again, because I tried it and that's what happened. The gcc
>> documentation says that -MM and -MMD don't inhibit compilation, so
>> object code must go one place and preprocessed output must go
>> elsewhere. From that I infered that -o is reserved for the object code
>> in this scenario.
>
> -MD and -MMD just cause side effects of running the preprocessor.  The
> preprocessed output gets fed into the compiler; it doesn't have to go
> anywhere else.
>

It seems like the way to deal with this, and other compiler oddities that
are sure to turn up in the future, is to write little wrapper scripts
around the compilers that account for differences. Think of it as a plug-in
architecture for distcc. There's nothing to stop anyone from doing this
right now with distcc 0.11, but maybe distcc could help things along
by passing along certain information to the compiler child process
via the environment or something, like the location of the distcc temp
directory for example. If this worked out then distcc could eventually get
completely out of the business of having to know anything beyond the
universal compiler options.

I'll see if I can slap together a wrapper script for gcc 2.96 and 3.0.4
as a proof of concept, at least to deal with -MD and -MMD. It could be a
while before I get to it.

Terry
-- 
Terry Griffin
Axian Inc.
http://www.axian.com/




More information about the distcc mailing list