LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   gcc second pass does not compile. LFS version 6.4 5.12 (https://www.linuxquestions.org/questions/linux-from-scratch-13/gcc-second-pass-does-not-compile-lfs-version-6-4-5-12-a-732813/)

arielsegal 06-14-2009 03:19 AM

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

druuna 06-14-2009 03:28 AM

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.

arielsegal 06-14-2009 07:08 AM

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?

arielsegal 06-14-2009 11:45 AM

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

druuna 06-14-2009 12:45 PM

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??

arielsegal 06-14-2009 02:42 PM

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.

druuna 06-14-2009 03:32 PM

Hi,

Looks like something went wrong with the glibc step:

ld: cannot find -lc -> ld is looking for libc, which is part of glibc.

arielsegal 06-14-2009 04:11 PM

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

druuna 06-14-2009 04:37 PM

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 :)

arielsegal 06-15-2009 01:42 AM

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.

druuna 06-15-2009 04:12 AM

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......

arielsegal 06-15-2009 07:06 AM

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.

druuna 06-15-2009 07:19 AM

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......

arielsegal 06-15-2009 08:15 AM

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.

druuna 06-15-2009 08:32 AM

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....


All times are GMT -5. The time now is 03:23 AM.