problem in chapter 6.

Doug Sutherland wearable at cogeco.ca
Fri Apr 2 17:07:26 PST 2004


First you install binutils to /tools in chapter 5, and after running the
install, you do the

make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib

Which changes the default library search path.

You install gcc, linux headers, and glibc. At this point, the default
gcc specs file points to /lib/ld-linux.so.2, but we want it to point to
/tools/lib/ld-linux.so2, so that everything is linked from /tools/lib
for the building of the temporary toolchain (rest of chapter 5). You
have to run make -C ld install from within your saved binutils-build
to install the adhjusted linker. Then you must remove binutils-build
directory before running the spec file adjust. The spec file adjust
changes from /lib/ld-linux.so.2 to /tools/lib/ld-linux.so.2. You run
the sanity test and make sure that the program interpreter is set to
/tools/lib/ld-linux.so.2 before proceeding.

Then in chapter 6, you install glibc, and reverse the change to the
specs file, so it points to /lib/ld-linux.so.2 for the real system.
You need the binutils-build saved from chapter five. You then install
the adjusted linker make -C ld INSTALL=/tools/bin/install install
Again you remove the binutils-build dir before running the spec file
adjust. The spec file adjust this time changes from /tools/lib/ to
/lib for the rest of the build. But you run the sanity check again
before proceeding, making sure that the program interpreter is set
to /lib/ld-linux-so.2.

There is a specs patch for gcc on the first pass build:
http://www.linuxfromscratch.org/patches/lfs/cvs/gcc-3.3.2-specs-1.patch
This changes the default location of the default linker.

 > Maybe I have done something wrong before, but when I change the spec
 > le in chapter 6, the probe works fine and the readelf shows that the
 > programs are linked to the /lib/ld.so

should be /lib/ld-linux.so.2

 > but when I compile only some steps later, the new gcc, the programs
 > compiled later uses the old /tools/lib/ld.so.

You must delete the gcc source tree before building it again in the
second pass. This is because it has been patched with the spec patch
that changes the default location of linker to /tools/lib/ld-linux.so.2
Did you not delete the gcc source tree? By running the spec adjust
another time, it appears that you reversed the default, which was
done by a patch. But had you deleted gcc source, and not applied the
specs patch on the second pass, all would work as in the book.

   -- Doug
  




More information about the lfs-support mailing list