[distcc] collect2: cannot find 'ld'

Jason Addison jraddison at gmail.com
Thu Nov 1 16:07:13 GMT 2007


On 10/31/07, Ihar `Philips` Filipau <thephilips at gmail.com> wrote:
> On 11/1/07, Jason Addison <jraddison at gmail.com> wrote:
> > Compiling works great. When it comes
> > to linking ... disaster!
>
> I was under strong impression that distcc cannot distribute linking.
> For example, if you would check its source code and see what it does and how
> it does distribution - you would see that's impossible.
>

Thanks for the response. Like you said, I probably have to start
investigating the distcc source to pin down the problem. I did not
think that distcc was trying to link on a remote machine. I thought
that, when it came time to link, it would do it locally. In fact, I
think that is what it is trying to do. I think that it is running g++,
which is running collect2 on my machine, but, due to the environment
not being propagated by SCons and ccache, collect2 can not find ld. I
explicitly directed Scons to use ld for linking, instead of distcc,
and it failed (I don't recall if it was the same failure).

> [ I have seen several commercial offerings - none of them provides
> distributed linking. ]
>
> > Linking fails with
> >
> > $ scons -j 7
> > ... compiliing ...
> > distcc -o MyApp ...
> > ...
> > collect2: cannot find 'ld'
> > distcc[24315] ERROR: compile (null) on localhost failed
> >
> > If I simply copy the link command and run it directly in the shell, it
> > works!
>
> For that to work, environments on both hosts have to match.
> Compilation doesn't have this problem - linking does.
>
> Just do linking locally. It's not a big deal anyway.
>

The more I think about it, the more I think that the problem has to do
with distcc running g++ when it comes time to link. When it tries to
run g++ on my machine, it runs the real g++, not ccache as it did on
the remote machine (where ccache is installed it looks as if g??
commands are intercepted using PATH and run ccache instead). Hmmmm ...
now that I consider it further, I probably need to learn more about
ccache.

Does anyone else use SCons / ccache / distcc or see the error of my ways?


More information about the distcc mailing list