having trouble with ld, and compiling gcc

Kevin P. Fleming kpfleming at linuxfromscratch.org
Wed Aug 4 11:06:04 PDT 2004

first last wrote:

>    * Here is the output:
>        Configuring for a i686-pc-linux-gnu host.
>        Created "Makefile" in /mnt/lfs/sources/gcc-build using "mt-frag"
>        /tools/bin/ld: unrecognized option '--as-needed'
>        /tools/bin/ld: use the --help option for usage information
>        collect2: ld returned 1 exit status
>        *** The command 'gcc -o conftest -g -O2   conftest.c' failed.
>        *** You must set the environment variable CC to a working compiler.

> I got rid of /tools symlink last time this happened and I didn't get this
> problem, but I had more problems later. So I thought I should start 
> over, and
> make sure I was doing everything right before I asked questions.

You are doing everything right, except for searching the list archives 
before reporting the problem. This problem has been discussed nearly 
every week for the last couple of months, and the cause is that you are 
using a host with newer tools than you are trying to build. Look at the 
other threads for solutions.

Website team: can we get this added to the FAQ?

More information about the lfs-support mailing list