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

Martin Pool mbp at samba.org
Wed Oct 2 05:04:01 GMT 2002


Building distcc using distcc works OK for me.  What version of gcc are
you using?

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

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

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

> 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 



More information about the distcc mailing list