collect2 picks wrong target-ld

Georg-Johann Lay
Sat Dec 3 17:45:00 GMT 2011

Georg-Johann Lay schrieb:
> Ian Lance Taylor schrieb:
>> Georg-Johann Lay:
>>> collect2 calls the wring linker (avr-ld).
>>> It calls avr-ld from $PATH instead of the linker as installed in the 
>>> toolchain and with --prefix.
>>> --prefix is not in $PATH but binutils are configured with the same 
>>> --prefix and installed before GCC was configured.
>>> I'd expect that a toolchain installation is self-contained and that 
>>> if there is
>>> a complete toolchain the tools can be called by their absolute paths?
>>> Similarly, collect2 in $BUILD calls avr-ld it finds in $PATH instead 
>>> of the avr-ld installed at --prefix.
>>> Is this a bug or a feature?
>>> From your description, that is a bug.  If you configure with the same
>> --prefix and --target, and you run both "make" and "make install", then
>> gcc should use the installed ld.  It shouldn't run "avr-ld".  It should
>> run "ld" from the special $(exec_prefix)/$(target_alias) directory.
>> That directory exists to hold tools that the compiler needs to run,
>> under canonical names.
>> Ian

You have an idea what is going wrong and where I have to look?

I am not familiar with that corner of the tools and have just a faint 
idea of how the actual right behaviour should exactly be at each point.

Why is collect2 searching for target-ld at all if it is supposed to use 
dedicated ld?

With -debug it spits out a directory list taken from $PATH and in some 
directory there is a target-ld which collect2 is calling.


> I added the INSTALL/bin directory to PATH with
> export PATH=INSTALL/bin:$PATH
> but after deleting the build directory, configuring and making again, it 
> still does not work and test cases with -flto are failing.
> up.  I wasted almost a week now and will switch back to 
> --disable-lto so that I can proceed with my work.
> Johann

More information about the Gcc-help mailing list