LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 06-14-2009, 04:19 AM   #1
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Rep: Reputation: 15
gcc second pass does not compile. LFS version 6.4 5.12


For some reason when I do make, it reconfigures, even though I have run configure script.
The the configure run by make does not recognize the arguments. They were recognized when I ran configure.
Then, I get a link error: cannot find -lc
Files libc.a/libc.so are in /tools/lib
Please help,
Ariel
 
Old 06-14-2009, 04:28 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

I do assume:
- your host system is up to specs as described by the LFS book,
- you removed the gcc step 1 build before starting with gcc step 2,
- nothing went wrong in the previous steps.

Can you post:
- the directory you are in when running the commands,
- the commands you are using,
- the last 10-15 lines of the error.
 
Old 06-14-2009, 08:08 AM   #3
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
I think that did not remove gcc of pass one. I followed the book, but maybe I missed this one. How to remove gcc pass 1? Where is it in the book?
 
Old 06-14-2009, 12:45 PM   #4
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
more details

Hi,
I'm posting the error message, I think I was wrong its not a link error:
Code:
/bin/sh ../../../gcc-4.3.2/libgcc/../mkinstalldirs .
/mnt/lfs/home/lfs/gcc-build/./gcc/xgcc -B/mnt/lfs/home/lfs/gcc-build/./gcc/ -B/tools/i686-pc-linux-gnu/bin/ -B/tools/i686-pc-linux-gnu/lib/ -isystem /tools/i686-pc-linux-gnu/include -isystem /tools/i686-pc-linux-gnu/sys-include -O2  -O2 -g -g -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -O2 -g -g -O2 -B./ _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o unwind-dw2_s.o unwind-dw2-fde-glibc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lc && rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/tools/i686-pc-linux-gnu/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[2]: *** [libgcc_s.so] Error 1
make[2]: Leaving directory `/mnt/lfs/home/lfs/gcc-build/i686-pc-linux-gnu/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/mnt/lfs/home/lfs/gcc-build'
make: *** [all] Error 2
druuna,
I did remove the build of gcc from pass 1. Thanks for your response.
Ariel
 
Old 06-14-2009, 01:45 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

There's still one thing you didn't answer (and I do believe your above problem is related): Is your host suitable to build LFS??
 
Old 06-14-2009, 03:42 PM   #6
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
I'm using the LFS 6.3 live CD environment to build LFS 6.4, I compile and install the packages of LFS 6.4.
I carefully maintain a script that will put me where I left after reset. I have divided my disk into 3 partitions, one for LFS, the other for my use, and then a swap partiton.
When I reboot the PC with the live CD in it, I manually mount the partition for my use, there I have the setup script that does all the rest.
 
Old 06-14-2009, 04:32 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Looks like something went wrong with the glibc step:

ld: cannot find -lc -> ld is looking for libc, which is part of glibc.
 
Old 06-14-2009, 05:11 PM   #8
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
I guess I'll have to to go through 5.7 again - building glibc. As I mentioned, I have found the files: libc.a and libc.so
in /tools/lib
 
Old 06-14-2009, 05:37 PM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Something must have gone wrong somewhere along the road. Maybe glibc was installed (partially?) correct and 5.8. Adjusting the Toolchain went wrong (a lot of people slip up at this point).

I don't And be sure your scripts are working the way you expect them to.....

One other thing: Is this: /mnt/lfs/home/lfs/<build-dir> a personal preference? The book suggests /mnt/lfs/sources (3.1. Introduction). There's nothing wrong with it as long as it is by choice
 
Old 06-15-2009, 02:42 AM   #10
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
I want to do from glibc 5.7 all over again. I will have to adjust the toolchain again 5.8.
Do I have to do 5.9 tcl and 5.10 expect and 5.11 dejaGNU again? I think I should.

Do I have to erase the installation of glibc and the result of the previous toolchain adjusting. If so, what should I erase? Where are the final loader and glibc installed?

the content of setup script is:
Quote:
export LFS=/mnt/lfs
mkdir -pv $LFS
mount -v -t ext3 /dev/hda1 $LFS
/sbin/swapon -v /dev/hda5
ln -sv $LFS/tools /
groupadd lfs
useradd -s /bin/bash -g lfs -d /mnt/lfs/home/lfs lfs
passwd lfs
chown -v lfs $LFS/tools
chown -v lfs $LFS/sources
./set-gcclib-link
ln -vs gcc /tools/bin/cc
ln -vs tclsh8.5 /tools/bin/tclsh
The content of set-gcclib-link is:
Quote:
ln -vs libgcc.a /mnt/lfs/tools/lib/gcc/i686-pc-linux-gnu/4.3.2/libgcc_eh.a
The path /mnt/lfs/home/lfs is because I'm doing all this from a lfs account and not as root.
 
Old 06-15-2009, 05:12 AM   #11
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Just start over again if you want to be sure. Mount $LFS and remove all that's there.

I see this in your 'script':
Quote:
./set-gcclib-link
ln -vs gcc /tools/bin/cc
ln -vs tclsh8.5 /tools/bin/tclsh
Why are they in your script? These should be executed once at the given moment/time in the book (first 2 are from gcc pass1, last one from tcl). Don't re-activate them after the first instance, there is a chance that after you re-adjust the toolchain this will create problems. And besides, they are already linked the first time you executed the commands.

I do think that the following steps from your script will issue warnings or are not needed (assuming it is run for a second/third/... time):
Quote:
mkdir -pv $LFS
ln -sv $LFS/tools /
chown -v lfs $LFS/tools
chown -v lfs $LFS/sources
The first 2 already exist and the last two should already have the correct owner.

Quote:
The path /mnt/lfs/home/lfs is because I'm doing all this from a lfs account and not as root.
If you did all the steps, the $LFS/sources directory should have all the correct permissions to let the LFS user do his thing......
 
Old 06-15-2009, 08:06 AM   #12
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
Druuna,
Thank you.
You are right about the links in the setup script.
About the first lines of making the $LFS directory, making the account and chown, since I'm using a live CD and the FS is on RAM, it is all lost when I shut down.

This time when I start all over again from 4.1 I'll be carful not activate the links more then once, check myself after each step.
 
Old 06-15-2009, 08:19 AM   #13
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Quote:
and the FS is on RAM, it is all lost when I shut down
I'm not sure if that is going to work (besides: you are definately going to have some 'fun' with scripting this). Maybe you can do chapter 5 this way (not even sure about that), but chapter 6 needs a fixed (not volatile) disk space (be it a real partition or a virtual disk).

But maybe it is possible, never tried this before......
 
Old 06-15-2009, 09:15 AM   #14
arielsegal
Member
 
Registered: Jul 2007
Posts: 38

Original Poster
Rep: Reputation: 15
Well, only the top of the FS is on RAM. As I said I have three partitions of a real disk. On one of them I install LFS. The setup script makes sure that the partition is mounted and lfs user is defined, and generally all the stuff that is kept on directories above /mnt/lfs
such as /sys , that are on RAM.
In the live CD docs it says that one can install LFS 6.3 with it, it has all packages on the CD. The difference is, that I got the packages of LFS 6.4 and saved them on the other partition, and follow the book of version 6.4.
Are there problems that I overlooked?
I'm doing this because no OS is installed on this computer, and I want that only LFS will be installed on it, without the trouble of installing first an OS.
 
Old 06-15-2009, 09:32 AM   #15
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

Assuming you use the LFS 6.3 liveCD and want to install LFS 6.4 (packages/patches are on a stick/external disk): You need a minimal of 2 partitions, one for LFS and the other being swap. If you use the liveCD then there is no need for another OS.

I get the feeling that you're complicating things too much (especially if you haven't installed LFS before and don't know how things are done).

Quote:
only the top of the FS is on RAM
What do you mean by this? If /mnt/lfs is on RAM then you will end up with a LFS system on RAM....
 
  


Reply


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
LFS-5.0 GCC problem with binutils-2.14 pass 1 NCappaZoo Linux From Scratch 6 06-14-2009 04:47 AM
unable to compile gcc 4.1.2 pass 1 version 6.3 Abdou_ENSI Linux From Scratch 2 01-30-2009 12:28 PM
LFS - 5.4. GCC-3.4.3 - Pass 1 - Failed cruiseoveride Linux From Scratch 7 06-07-2007 11:34 PM
LFS GCC - first pass install error arnuld Linux From Scratch 2 12-20-2006 08:59 AM
Error Compiling GCC (1st Pass) in LFS 6.0 TGWDNGHN Linux From Scratch 1 06-30-2005 09:57 PM


All times are GMT -5. The time now is 04:40 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration