2

I'm building lfs-7.5.

When I run make mrproper in chapter 6.7, it says:

make: gcc: command not found

and on running bash /tools/bin/gcc, it says:

bash: /tools/bin/gcc: no such file or directory

This is the same problem as here. Even the information given by the person who asked the question in the comments is same as mine.

He says that he did "third pass" of gcc in chapter 5. If this was the case then the author of LFS would have clearly indicated to us to perform 3 passes. I'm guessing that I'm making a subtle mistake somewhere, but I can't seem to find out where.

According to the support provided by LFS authors, they ask us to redo the whole thing from the beginning. I agree with them, but without knowing where the mistake might have happened we are bound to make the same mistake again (as I did). The output provided by the person who asked the question in the LFS support question matches mine. This is the link.

Another question about the same topic here did not yield any answers.

Please help.

BTW, when I found out that gcc was not linked to the libraries in /tools/lib of LFS, I manually created a simlink from libc.so.6 to /lib and /lib64 under /mnt/lfs where I mounted the LFS partition. But when I was executing make headers_check in 6.7 (after make mrproper), it complained that it didn't find libz.so and when I searched in /tools/lib, I couldn't find it.

3 Answers 3

3

I don't know whether the previous answer I submitted is correct or not.

I decided to continue doing LFS-7.5 in Linux Mint, where user lfs was present in the sudoers file. After finishing Chapter 5, I again got an error at Chapter 6.7 make mrproper. So, I deleted all folder under $LFS except $LFS/sources and started from the beginning.

After finishing the 2nd pass of gcc, I checked whether the libraries of gcc pointed to the ones under $LFS/tools or not. But I found out that they were still pointed at /usr of host system.

So, I re-built from 1st pass of gcc and then everything was fine.

So, after 2nd pass of gcc, do:

ldd $LFS/tools/bin/$LFS_TGT-gcc

and if the resulting output points to /usr, redo from 1st pass of gcc.

At least, this the method I used and immediately after redoing the 1st pass of gcc the 2nd time, the output of the above command was pointing to $LFS/tools/lib.

0

I was able to successfully execute make mrproper and the following commands. I don't really know whether this is really the solution to the above problem. Anyway here it is:

I was using Ubuntu 14.04 and I created lfs user as suggested by the LFS-7.5 book. But the problem was that I didn't realize until later, much later, when chrooting into the LFS partition that, lfs user was not in the sudoers file.

Ubuntu did (does?) not automatically add the user to the sudoers file, probably by design by the Ubuntu people. This might be the reason, I did not try it again on Ubuntu.

I got disheartened and started trying LFS-7.5 in Linux Mint 16 and it automatically added the user to the sudoers file and everything went fine at Chapter 6.7 while building and installing linux headers.

0

I had exactly the same problem. I checked the dynamic linker used by gcc : readelf -l /tools/bin/gcc | grep interpreter and it was not /tools/lib64/ld-linux-x86-64.so.2 but /lib64/ld-linux-x86-64.so.2. So, gcc could not run because this file did not exist.
The problem came from the gcc Pass2 building step. I did not put the definition of CC, CXX, AR and RANLIB on the same line than the configure command.

I ran

CC=$LFS_TGT-gcc
CXX=$LFS_TGT-g++
AR=$LFS_TGT-ar
RANLIB=$LFS_TGT-ranlib
../configure --prefix=/tools ...

Instead of

CC=$LFS_TGT-gcc \
CXX=$LFS_TGT-g++ \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../configure --prefix=/tools ...

Same problem could apply in binutils pass2 build step. I suppose it is a problem of variable focus.

You must log in to answer this question.

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