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

Terry Griffin terryg at axian.com
Wed Oct 2 16:05:09 GMT 2002


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

>
> On  1 Oct 2002, Terry Griffin <terryg at axian.com> wrote:
>
>> Got it. It's the -MMD switch on the compiler (-MD also). This causes
>> preprocessed output to go to stdout instead of to the file specified
>> by the -o switch.
>
> Where in the gcc manual does it say that the preprocessed output will go
> to stdout?
>

It doesn't, but I tried it and that's what I got.

> It seems to work for me:
>
>     !1146 14:44 /tmp/test% ls -la
>     total 56
>     drwxr-xr-x    2 mbp      mbp          4096 2002-10-02 14:44 .
>     drwxrwxrwt   15 root     root        49152 2002-10-02 14:44 ..
> -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
> !1147 14:44 /tmp/test% gcc -MD hello.c -E -o hello.i
>     !1148 14:44 /tmp/test% ls -la
>     total 84
>     drwxr-xr-x    2 mbp      mbp          4096 2002-10-02 14:44 .
>     drwxrwxrwt   15 root     root        49152 2002-10-02 14:44 ..
> -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
> -rw-r--r--    1 mbp      mbp           501 2002-10-02 14:44 hello.d
> -rw-r--r--    1 mbp      mbp         21097 2002-10-02 14:44 hello.i
> !1149 14:44 /tmp/test% rm hello.d hello.i
>     !1150 14:46 /tmp/test% gcc-3.2 -MD hello.c -E -o hello.i
>     !1151 14:46 /tmp/test% ls -la
>     total 80
>     drwxr-xr-x    2 mbp      mbp          4096 2002-10-02 14:46 .
>     drwxrwxrwt   15 root     root        49152 2002-10-02 14:44 ..
> -rw-r--r--    1 mbp      mbp            76 2002-10-02 14:44 hello.c
> -rw-r--r--    1 mbp      mbp           536 2002-10-02 14:46 hello.d
> -rw-r--r--    1 mbp      mbp         18019 2002-10-02 14:46 hello.i
>

For me, these same commands with gcc 2.96 and gcc 3.04 give me
preprocessed output to stdout and no .i file.

>> Unlike the plain -M switch, -MM and -MMD do not inhibit normal
>> compilation. Because of this the -o switch is reserved to specify the
>> location of the object file, but since the -E switch is also specified
>> no object file is produced, and hence no .i file (which would have
>> been the wrong file type anyway).
>
> What do you mean it would have been the wrong file type?
>

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.

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

>
>> Also, the .d files produced by -MM and -MMD end up in the wrong
>> place. They're getting written to distcc's tmp directory instead of
>> the intended location.
>
> OK, that's a good point.  gcc is looking at the altered -o output to
> calculate the dependency file name.  This behaviour has changed
> between gcc-2.95 and 3.2.  2.95 only looked at the source file and
> therefore was fine with -o.
>
>> So -MM and -MMD switches need special handling. And distcc needs to
>> verify that the .i file actually exists before bothering to send it to
>> distccd.
>
> Yes, it should check that.
>
> --
> Martin
> _______________________________________________
> distcc mailing list
> distcc at lists.samba.org
> http://lists.samba.org/cgi-bin/mailman/listinfo/distcc

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




More information about the distcc mailing list