From 313ca76210ced5b65eb0a30594959d6fc8ae5115 Mon Sep 17 00:00:00 2001 From: Jeremy Huntwork Date: Thu, 26 Jan 2006 03:45:12 +0000 Subject: [PATCH] Fixed the re-adjusting of the toolchain in chapter 6 so that chapter 6 GCC and Binutils links against the proper Glibc and so that we don't have to keep the binutils directories from chapter 5. Also moved a note about saving the /tools directory to the beginning of chapter 6. Fixes bug 1677. Thanks to Chris Staub, Alexander Patrakov, Greg Schafer and Tushar Teredesai for reporting and resolving this issue. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7306 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter01/changelog.xml | 8 ++++++ chapter05/binutils-pass2.xml | 12 --------- chapter06/gcc.xml | 5 ---- chapter06/introduction.xml | 5 ++++ chapter06/readjusting.xml | 51 +++++++++++++----------------------- chapter06/revisedchroot.xml | 3 +-- 6 files changed, 32 insertions(+), 52 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index f669191a7..b956245c2 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -48,6 +48,14 @@ the correct Glibc. Fixes bug 1675. Thanks to Dan Nicholson for the report and Greg Schafer for the fix. + + [jhuntwork] - Fixed the re-adjusting of the toolchain in chapter 6 + so that chapter 6 GCC and Binutils links against the proper Glibc and so + that we don't have to keep the binutils directories from chapter 5. Also + moved a note about saving the /tools directory to the beginning of chapter 6. + Fixes bug 1677. Thanks to Chris Staub, Alexander Patrakov, Greg Schafer and + Tushar Teredesai for reporting and resolving this issue. + diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml index 8a7cc53ff..d1bbec87f 100644 --- a/chapter05/binutils-pass2.xml +++ b/chapter05/binutils-pass2.xml @@ -82,18 +82,6 @@ cd ../binutils-build make install - Now prepare the linker for the Re-adjusting phase in - the next chapter: - -make -C ld clean -make -C ld LIB_PATH=/usr/lib:/lib - - - Do not remove the Binutils source and build - directories yet. These directories will be needed again in the next - chapter in their current state. - - diff --git a/chapter06/gcc.xml b/chapter06/gcc.xml index b67e4ede7..e8c49be34 100644 --- a/chapter06/gcc.xml +++ b/chapter06/gcc.xml @@ -99,11 +99,6 @@ To support those packages, create this symlink: ln -sv ../usr/bin/cpp /lib -Many packages use the name cc to call the C -compiler. To satisfy those packages, create a symlink: - -ln -sv gcc /usr/bin/cc - At this point, it is strongly recommended to repeat the sanity check performed earlier in this chapter. Refer back to and repeat the check. If the results diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index 8ca571197..065baeeed 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -58,5 +58,10 @@ package. Following the installation instructions, there is a list of programs and libraries (along with brief descriptions of these) that the package installs. +At this point, you may wish to keep your finished temporary +tools for use in future LFS builds by creating a tarball of the +/tools directory and +storing it in a safe location. + diff --git a/chapter06/readjusting.xml b/chapter06/readjusting.xml index 9a24e7597..4c2a82f75 100644 --- a/chapter06/readjusting.xml +++ b/chapter06/readjusting.xml @@ -9,7 +9,7 @@ Now that the final C libraries have been installed, it is time to adjust the toolchain again. The toolchain will be adjusted so that it will link any -newly compiled program against these new libraries. This is the same process +newly compiled program against these new libraries. This is a similar process used in the Adjusting phase in the beginning of , but with the adjustments reversed. In , the chain was guided from the host's @@ -19,38 +19,7 @@ be guided from that same /tools/lib directory to the LFS /{,usr/}lib directories. -Start by adjusting the linker. The source and build directories from the -second pass of Binutils were retained for this purpose. Install the adjusted -linker by running the following command from within the binutils-build directory: - -make -C ld INSTALL=/tools/bin/install install - -If the earlier warning to retain the Binutils source and -build directories from the second pass in was missed, or if they were -accidentally deleted or are inaccessible, ignore the above command. -The result will be that the next package, Binutils, will link against -the C libraries in /tools -rather than in /{,usr/}lib. -This is not ideal, however, testing has shown that the resulting -Binutils program binaries should be identical. - -From now on, every compiled program will link only against the -libraries in /usr/lib and -/lib. The extra -INSTALL=/tools/bin/install option is needed -because the Makefile file created during the -second pass still contains the reference to -/usr/bin/install, which has not been installed yet. -Some host distributions contain a ginstall symbolic link which takes -precedence in the Makefile file and can cause a -problem. The above command takes care of this issue. - -Remove the Binutils source and build directories now. - -Next, amend the GCC specs file so that it points to the new +First, amend the GCC specs file so that it points to the new dynamic linker. A sed command accomplishes this: SPECFILE=`dirname $(gcc -print-libgcc-file-name)`/specs && @@ -69,6 +38,22 @@ dynamic linker in the above commands. Refer back to if necessary. +Now create temporary wrapper scripts for gcc and +ld. These scripts will point to their real counterparts +in /tools but with adjusted parameters +to ensure that GCC in the next section links to our newly installed Glibc. + +cat > /usr/bin/gcc << "EOF" +#!/bin/bash +/tools/bin/gcc -B/usr/lib $@ +EOF +cat > /usr/bin/ld << "EOF" +#!/bin/bash +/tools/bin/ld -nostdlib -L/usr/lib -L/lib $@ +EOF +chmod 755 /usr/bin/{ld,gcc} +ln -s gcc /usr/bin/cc + It is imperative at this point to stop and ensure that the basic functions (compiling and linking) of the adjusted toolchain are working as expected. To do this, perform a sanity diff --git a/chapter06/revisedchroot.xml b/chapter06/revisedchroot.xml index b2f1b3afe..29eeba80a 100644 --- a/chapter06/revisedchroot.xml +++ b/chapter06/revisedchroot.xml @@ -18,8 +18,7 @@ exiting, use the following modified chroot command: The reason for this is that the programs in /tools are no longer needed. Since they are no longer needed you can delete the /tools -directory if so desired or tar it up and keep it to build another final -system. +directory if so desired. Removing /tools will also remove the temporary copies of Tcl, Expect, and DejaGNU which were used for