collect2: cannot find ld

Rob Landley rob at
Wed Mar 29 17:23:18 UTC 2006

On Wednesday 29 March 2006 5:09 am, Pablo León wrote:
> After some days of tweaking, finally I have got my uClib development
> system (almost) working.

There's a bug in some versions of gcc that if "." is in your path, collect2 
will ignore $PATH when looking for ld because the FSF thinks it knows better 
than you do in that case.

That was the cause of my persistent "can't find ld" bug, and I had to trace 
through the collect2 source code to figure out why.  But that doesn't seem to 
be affecting you here...

> I have build it using buildroot with 
> busybox-1.1.1, gcc-3.4.6, make-3.80, and all of the compiling stuff
> needed. I can even compile and run a simple "Hello World" c program
> without any problem.
> But when I try to compile any standard "configure/make/make install"
> linux package, I always get the following error message at configure stage:
> configure: error: installation or configuration problem: C compiler
> cannot create executables.
> And config.log states:
> configure:722: gcc -o conftest conftest.c 1>&5
> collect2: cannot find 'ld'
> configure: failed program was:
> #line 768 "configure"
> #include "confdefs.h"
> main(){return(0);}
> I have double-checked that ld is in the PATH. The only thing suspicious
> to me is that ash export feature seems broken:

Does msh have the same problem?

> root at uc:/usr/local# export PATH
> root at uc:/usr/local# cat testpath
> #! /bin/sh
> echo $PATH
> root at uc:/usr/local# echo $PATH
> /bin:/sbin:/usr/bin:/usr/sbin
> root at uc:/usr/local# ./testpath
> /usr/local/bin:/usr/bin:/sbin:/bin

Does running /bin/sh read in any kind of profile?

> Any way, ld is located at /usr/bin, so it should be located by collect2.



> Any hint would be very appreciated. Thank you very much.
> _______________________________________________
> busybox mailing list
> busybox at

Never bet against the cheap plastic solution.

More information about the busybox mailing list