Opened 20 years ago

Closed 20 years ago

#885 closed defect (wontfix)

GCC-3.3.3 - Pass 1 fails at Prepare GCC for compilation

Reported by: a_spicer@… Owned by: lfs-book@…
Priority: highest Milestone:
Component: Book Version: 5.1.1
Severity: major Keywords:
Cc: a_spicer@…

Description

Following the 5.1.1 LFS book (html version) exactly word for word, at the GCC-3.3.3 - Pass 1 section, in the "Prepare GCC for compilation" portion of that page (again following this book word for word) we are to do the following:

../gcc-3.3.3/configure --prefix=/tools \

--with-local-prefix=/tools \ --disable-nls --enable-shared \ --enable-languages=c

But this fails with the following exact error messages:

lfs:/mnt/lfs/sources/gcc-build$ ../gcc-3.3.3/configure --prefix=/tools --with-local-prefix=/tools --disable-nls --enable-shared --enable-languages=c 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.

Thinking this has to be an LD problem with the LD that we are using in this "protected" build environment ... the current "host GCC" must be using something that "protected /tools/bin/ld" doesn't like?

While Google groups searching for this I found:

http://groups.google.com/groups?q=%22unrecognized+option+%27--as-needed%27%22&hl=en&lr=&ie=UTF-8&selm=1SmcR-6sh-9%40gated-at.bofh.it&rnum=1

  • This persons problem was similar, although not exactly our environment. I

translated his "specs" file location to my local machine (again, Fedora Core 2) and took out 1 each of "--as-needed" and "--no-as-needed", and ran the LFS book's configure command again. This time it succeeded. Problem gone.

The fix, such as it is, is to edit /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs and remove all references to --as-needed and --no-as-needed (there aren't many). ld is then happy, and things compile well.

Change History (1)

comment:1 by jeremy@…, 20 years ago

Resolution: wontfix
Status: newclosed

In the future, please search the LFS Mailing list archives at http://www.linuxfromscratch.org/search.html. Had you done that, you would have found that this exact issue happens when using FC2 (which uses the newer binutils 2.15 series) to build LFS 5.1.1 (using binutils 2.14). 2.15 supports the --as-needed option, where 2.14 does not, and this ends up polluting the build. Your options are:

a) use an older host distro to build from

b) substitute binutils 2.15 for binutils 2.14 in LFS 5.1.1, also installing M4, bison, and flex as part of chapter 5.

Note: See TracTickets for help on using tickets.