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?

  • What is in your $PATH? Where are gcc, readelf, ld, etc installed to? – casey Jan 20 '14 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 Jan 20 '14 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 Jan 21 '14 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 Jan 21 '14 at 14:16

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
    I successfully finished the LFS, it is all working now. – Granada Jan 22 '14 at 13:41

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.