lfs-book, version 6.4, chapter 6.7, "make: gcc: Command not found"

Chris Staub chris at beaker67.com
Fri Feb 13 19:47:05 PST 2009


Aaron Schawalder wrote:
> (I apologize for sending this mail again. I have sent the last mail with 
> wrong return address. I am sorry.)
> 

I'm seeing a long list of problems with what you're doing...

> Hello
> 
> I am new to lfs and have successfully built the toolchain. At the end 
> oft chapter "5.12 GCC-4.3.2 - Pass 2" the output of readelf was correct:
> 
> lfs at esprit:/mnt/lfs/tools$ echo 'main(){}' > dummy.c
> lfs at esprit:/mnt/lfs/tools$ cc dummy.c
> lfs at esprit:/mnt/lfs/tools$ readelf -l a.out | grep ': /tools'
>      [Requesting program interpreter: /tools/lib/ld-linux.so.2]
> 
At least this much is correct.

> All went fine and I was very careful to always strictly follow the 
> commands of the lfs-book.
> 
> I entered chapter 6.7 and I performed the following commands:
> root:/sources# tar jxf linux-2.6.27.4.tar.bz2
> root:/sources# cd linux-2.6.27.4
> root:/sources/linux-2.6.27.4# make mrproper
> make: gcc: Command not found
> root:/sources/linux-2.6.27.4# gcc --version
> bash: /tools/bin/gcc: No such file or directory
> 
> Something is wrong ...
> 
> I performed the following tests:
> /home/lfs is the home directory of user "lfs"
> 
> root:/sources/linux-2.6.27.4# exit
> logout
> esprit:/home/lfs# echo $LFS
> /mnt/lfs
> esprit:/home/lfs# readelf -l /tools/bin/gcc | grep interpret
>      [Requesting program interpreter: /lib/ld-linux.so.2]
> esprit:/home/lfs#

I don't see the point of this. You're neither the lfs user nor inside 
chroot - this is just as a regular user, so you're only testing the host 
system's gcc.

> 
> esprit:/home/lfs# echo 'main(){}' > dummy.c
> esprit:/home/lfs# cc dummy.c
> bash: cc: command not found
> esprit:/home/lfs# cd /tools/bin
> esprit:/tools/bin# vdir ./cc
> lrwxrwxrwx 1 root root 3 Jan  4 07:57 ./cc -> gcc
> esprit:/tools/bin#

Obviously "cc" isn't going to be found if /tools/bin isn't in the PATH.
> 
> New login as user "lfs" just as in chapter 5:
> lfs at esprit:~$ cd /mnt/lfs/tools/
> lfs at esprit:/mnt/lfs/tools$ ls
> bin  etc  i686-pc-linux-gnu  include  lib  libexec  sbin  share  var
> lfs at esprit:/mnt/lfs/tools$ echo 'main(){}' > dummy.c
> bash: dummy.c: Permission denied
> lfs at esprit:/mnt/lfs/tools$ su
> Password: esprit:/mnt/lfs/tools# echo $PATH
> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
> esprit:/mnt/lfs/tools# echo 'main(){}' > dummy.c
> esprit:/mnt/lfs/tools# ls
> bin  dummy.c  etc  i686-pc-linux-gnu  include  lib  libexec  sbin  
> share  var
> esprit:/mnt/lfs/tools# ./bin/cc dummy.c esprit:/mnt/lfs/tools# readelf 
> -l a.out | grep interpret
>      [Requesting program interpreter: /tools/lib/ld-linux.so.2]
> esprit:/mnt/lfs/tools#
> I don't understand why this failure occurs. I would be pleased if 
> somebody could give me advise in this issue.
> 
> Kind regards
> 
> A.Schawalder

readelf -l /tools/bin/gcc | grep interpret

My guess is it will say /lib, not /tools/lib. If so, gcc is linked 
wrong, in which case my guess would be that you forgot to rm the source 
and/or build dirs for gcc in between pass 1 and pass 2. If that's the 
case, you'll need to rm -rf /tools/* and go back to the beginning of 
chapter 5.



More information about the lfs-support mailing list