collect2 picks wrong target-ld

Georg-Johann Lay
Thu Dec 1 20:46:00 GMT 2011

Ian Lance Taylor schrieb:
> Georg-Johann Lay <> writes:
>>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 way 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

I added the INSTALL/bin directory to PATH with


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.


More information about the Gcc-help mailing list