LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Error configuring GCC, First Pass (https://www.linuxquestions.org/questions/linux-from-scratch-13/error-configuring-gcc-first-pass-214274/)

lloyd_smart 08-06-2004 10:45 AM

Error configuring GCC, First Pass
 
Hi all. I'm attempting to compile LFS-5.1.1, and am having some problems. Binutils appeared to go smoothly, but when it came to building GCC-3.3.3 pass-one, I got the following error message on configuring:

Code:

Configuring "Makefile" in /mnt/lfs/sources/gcc-build using 'mt-frag'
/tools/bin/ld: Unrecognised option '--as needed'
/tools/bin/ld: Use the --help option for usage information
collect2: ld returned 1 exit status
***The command 'gcc conftest -g -02 conftest.c' failed.
***You must set the CC environment variable CC to a working compiler.

I'm quite new to all this, so please try to keep it simple, although any help will be greatly appreciated. Even if you don't have a solution to my problem, if you could explain to me what it means that would be great.

Thanks in advance! :)

jomen 08-06-2004 11:15 AM

sorry if I do not answer that one directly, but instead give you directions...
I - and others - have commented on exactly the same issue...may have been yesterday or even 3 or 4 days ago...
I cannot remember, so: try searching for posts from me or Andrew Benton - I remember him adding to this issue

this is (most probable) due to a typo in your command (did you cut & paste it?)

lloyd_smart 08-06-2004 11:44 AM

I didn't cut-and-paste the command, but I did check it very carefully several times, and I'm sure there was no typo. Here's what I typed:

Code:

../gcc-3.3.3/configure --prefix=/tools --with-local-prefix=/tools --disable-nls --enable-shared --enable-languages=c
I tried searching for posts by you and Andrew Benton within the LFS forum, but it mostly turned up hardware stuff (CPU overheating etc.)

Any other ideas? What's this CC environment variable thing all about?

Please excuse my "newbieness"! :)

jomen 08-06-2004 12:18 PM

the thread I was referring to is here:

http://www.linuxquestions.org/questi...5&goto=newpost

I did not follow it and don't know, if anything came out - maybe asking the one who posted the question will help?

if this was really your command, then I wonder where the error-message got, what it is saying:

/tools/bin/ld: Unrecognised option '--as needed'

jomen 08-06-2004 12:36 PM

The CC environment-variable normally contains the real name - maybe even the path and the name of your compiler - you can use it to select the compiler ... if you have different versions installed - this is described in the hints, which are available for LFS

if I do: "echo $CC" I get this: cc

Jonathan:/home/jochen# echo $CC
cc


in my .bash_profile I have these entries - which enable me to easyly change, which compiler gets used:

CC=cc
CXX=c++
#CC=/opt/gcc-2.95.3/bin/gcc
#CXX=/opt/gcc-2.95.3/bin/cc++

export CC CXX

if I comment out the first two and uncomment the second two - then source the file or log out and back in - which does the same - I will then be using gcc-2.95.3 which is in /opt/gcc-2.95.3/bin/gcc
- that is: if the makefile references the compiler by using this variable...

lloyd_smart 08-11-2004 11:42 AM

Nope, that didn't work. Never mind though. I've gotten around the problem by dumping Fedora Core 2 in favour of Debian as the host system. It seems to work on that. I know it's not the ideal solution, and I'd really have liked to have kept Fedora, but what's done is done. I had no choice because I'm working on a small hard drive.

gaidin_ 09-28-2004 11:45 PM

I found while using Knoppix to build my LFS 5.11 that I had to set the CC environment variable to point to the gcc-2.95 instead gcc-3.3 that /usr/bin/gcc was linked to. As soon as I did this the error went away.

Engl 09-29-2004 04:45 PM

Short disclaimer:
Im a total Linux newbie, started looking into LFS two days ago and compiled my first Linux program ever yesterday. Be warned.

From what I can tell based on experience and looking around on the net, the problem has nothing to do with the actual CC variable, the problem is further up, and the problem is that GCC 3.3.3 (used by Fedora 2) tries to use the --as-needed flag with the ld you compiled one step earlier (in binutils). LFS uses binutils 2.14, and that version of ld does not support --as-needed. Somehow GCC 3.3.3 checks for binutils version on the host system instead of checking the ld it is about to use.

To fix it, use an older GCC or use binutils 2.15 in your LFS.

pjer 10-29-2004 11:45 AM

- Run gcc -v and check the output for line "Reading specs from /usr/lib........./specs
- Save backup copy of specs file.
- Edit this file and find (and delete) option --as-needed
- After building the LFS copy back your original specs file.


All times are GMT -5. The time now is 02:21 PM.