LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-06-2004, 10:45 AM   #1
lloyd_smart
LQ Newbie
 
Registered: Dec 2003
Posts: 24

Rep: Reputation: 15
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!
 
Old 08-06-2004, 11:15 AM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
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?)
 
Old 08-06-2004, 11:44 AM   #3
lloyd_smart
LQ Newbie
 
Registered: Dec 2003
Posts: 24

Original Poster
Rep: Reputation: 15
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"!
 
Old 08-06-2004, 12:18 PM   #4
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
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'
 
Old 08-06-2004, 12:36 PM   #5
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,687

Rep: Reputation: 55
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...
 
Old 08-11-2004, 11:42 AM   #6
lloyd_smart
LQ Newbie
 
Registered: Dec 2003
Posts: 24

Original Poster
Rep: Reputation: 15
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.
 
Old 09-28-2004, 11:45 PM   #7
gaidin_
LQ Newbie
 
Registered: Sep 2004
Posts: 2

Rep: Reputation: 0
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.
 
Old 09-29-2004, 04:45 PM   #8
Engl
LQ Newbie
 
Registered: Sep 2004
Posts: 2

Rep: Reputation: 0
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.

Last edited by Engl; 09-29-2004 at 05:07 PM.
 
Old 10-29-2004, 11:45 AM   #9
pjer
LQ Newbie
 
Registered: Oct 2004
Posts: 1

Rep: Reputation: 1
- 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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Compiling GCC (1st Pass) in LFS 6.0 TGWDNGHN Linux From Scratch 1 06-30-2005 08:57 PM
GCC pass 1 error mugwump84 Linux From Scratch 2 05-10-2005 05:21 PM
error while configuring gcc-3.3.3 (pass1) alext_29 Linux From Scratch 4 09-28-2004 11:48 PM
LFS5.1.1 gcc-core-3.3.3 bootstrap (first pass) error. Cynric Linux From Scratch 3 08-18-2004 09:34 PM
binutils-2.14 first pass, gcc error Add1Sun Linux From Scratch 3 04-29-2004 04:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration