Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
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.


  Search this Thread
Old 07-14-2004, 02:58 PM   #1
LQ Newbie
Registered: Jul 2004
Location: Leuven, Belgium
Distribution: Mandrake 10, LFS 5.1.1, Debian
Posts: 29

Rep: Reputation: 15
Compiling GCC (pass1):ld cannot find -lc

Ok, I downloaded all the sources, and I've been closely following the instructions in the book. Everything was fine until I compiled GCC 3.3.3 (first pass) as follows:

make BOOT_LDFLAGS="-static" bootstrap

Unfortunately, the result was (after a few minutes, of course):

echo stage2_build > stage_last
make CC=" stage1/xgcc -Bstage1/ -B/tools/i686-pc-linux-gnu/bin/" \
         STAGE_PREFIX=stage1/ \
         ADAC="\$(CC)" AR_FOR_TARGET="ar" RANLIB_FOR_TARGET="ranlib" CFLAGS="-g -O2" LDFLAGS="-static" WARN_CFLAGS="\$(GCC_WARN_CFLAGS)" STRICT_WARN="-Wtraditional -pedantic -Wno-long-long" libdir=/tools/lib LANGUAGES="c gcov " MAKEOVERRIDES= OUTPUT_OPTION="-o \$@"
make[2]: Entering directory `/mnt/lfs/sources/gcc-build/gcc'
stage1/xgcc -Bstage1/ -B/tools/i686-pc-linux-gnu/bin/ -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H -DGENERATOR_FILE    -I. -I. -I../../gcc-3.3.3/gcc -I../../gcc-3.3.3/gcc/. -I../../gcc-3.3.3/gcc/config -I../../gcc-3.3.3/gcc/../include ../../gcc-3.3.3/gcc/gengenrtl.c -o gengenrtl.o
stage1/xgcc -Bstage1/ -B/tools/i686-pc-linux-gnu/bin/   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H -DGENERATOR_FILE -static -o gengenrtl \
 gengenrtl.o ../libiberty/libiberty.a
/tools/i686-pc-linux-gnu/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[2]: *** [gengenrtl] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/gcc-build/gcc'
make[1]: *** [stage2_build] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build/gcc'
make: *** [bootstrap] Error 2
It looks like the problem is that the linker can't find "-lc". I was looking at the output of the binutils build, and I noticed a couple places where the configure output said something like "Check to see if -lc should be explicitly linked" or something like that, along with other errors stating that "complete static linking is impossible in this environment."

Any suggestions? How do I go about troubleshooting this?

If it matters, I'm using Mandrake 10 as my host.

Old 07-14-2004, 06:13 PM   #2
Andrew Benton
Senior Member
Registered: Aug 2003
Location: Birkenhead/Britain
Distribution: Linux From Scratch
Posts: 2,073

Rep: Reputation: 64
My suggestion would be to read the FAQ. I didn't read the FAQ when I hit this error, I did what I always do when I get an error, I fed the error message into Google. Google told me to read the FAQ
Old 07-15-2004, 02:48 AM   #3
LQ Newbie
Registered: Jul 2004
Location: Leuven, Belgium
Distribution: Mandrake 10, LFS 5.1.1, Debian
Posts: 29

Original Poster
Rep: Reputation: 15
Wow... I know I read the FAQ (at least all the links there are purple) but somehow that escaped me. Thanks for the help (and for being polite!)



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
ld: cannot find -lc while compiling gcc cheema Linux From Scratch 9 03-20-2005 07:09 AM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM
error while configuring gcc-3.3.3 (pass1) alext_29 Linux From Scratch 4 09-28-2004 11:48 PM
Various Compiling Errors (GCC compiling Openal, GUIlib, xmms-wma) gregorya Linux - Software 2 08-27-2004 05:03 AM
gcc pass1 in chap5 doesn't get very far! davemar Linux From Scratch 3 03-31-2004 03:51 PM > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:40 PM.

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