3

I am (again) trying LFS. The version is 7.4

I am stuck at chapter 6.7, where I must run: make mrproper and I get this error: make: gcc: Command not found. But the gcc is there. I also cannot run readelf or ld, I get the same error.

After some search on the web I found out that this is something done wrong and that I should start all over again. Well, I started all over and got the same error at the same point. I made more searching and I tried starting from the beginning again, but still I got the same error.

How can I solve this problem?

4
  • What is in your $PATH? Where are gcc, readelf, ld, etc installed to?
    – casey
    Commented Jan 20, 2014 at 22:51
  • My PATH /bin:/usr/bin:/sbin:/usr/sbin:/tools/bin Gcc, readelf and ld are in /tools/bin/ and if I use the full path /tools/bin/gcc I get bash: /tools/bin/gcc: No such file or directory. g++ gives the same error. But outside the chroot environment, on the host if I run /tools/bin/gcc I can compile a dummy file.
    – Granada
    Commented Jan 20, 2014 at 23:22
  • Try ldd /tools/bin/gcc (in or out of the chroot). If it references anything outside the root you missed a step somewhere.
    – Mat
    Commented Jan 21, 2014 at 4:08
  • I started all over again. Now I just finished the second pass of gcc. ldd shows this: linux-vdso.so.1 (0x00007fff011fe000) libm.so.6 => /usr/lib/libm.so.6 (0x00007f237da6f000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f237d6c5000) /lib64/ld-linux-x86-64.so.2 (0x00007f237dd72000). I guess that this is wrong. But when I run the sanity check om the Page 50 using readelf after compiling a dummy file i get [Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2], that is the expected.
    – Granada
    Commented Jan 21, 2014 at 14:16

2 Answers 2

1

After running the second pass of gcc, ldd was pointing that gcc was using the host libraries. I didn't know how to solve it, so I simply ran the second pass of gcc again, but using the gcc binary of the last second pass without passing a CC variable.

Then ldd started to show that gcc was using the stuff under /tools.

But the binaries of binutils was also using the host libs, so I made again the second pass of binutils, without the CC, CXX, RANLIB or AR. This time it worked, I guess.

Now I am compiling glibc inside the chroot environment and so far I had no more problems. I don't know if what I did was right, but it did work.

1
  • 1
    I successfully finished the LFS, it is all working now.
    – Granada
    Commented Jan 22, 2014 at 13:41
0

I had this issue the first and second time I went through LFS. I was using multiple console windows to build multiple packages at the same time because there are a lot of small packages to build.

I started over a third time and decided just to build one package at a time. It took a long time but I got everything to compile correctly and work properly in the chroot environment.

If you run into this problem, you should probably just start over:

rm -rf /mnt/lfs/tools/*

Then just rebuild all of the packages, one at a time, following all instructions exactly. It is also not recommended to build this inside VirtualBox but I was able to get it to work after a couple of tries.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .