collect2 picks wrong target-ld (was: ld: bad -plugin option)

Ian Lance Taylor
Thu Dec 1 18:40:00 GMT 2011

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.


More information about the Gcc-help mailing list