diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 7ad4092ba..fa9877e46 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -40,6 +40,40 @@ appropriate for the entry or if needed the entire day's listitem. --> + + 2022-03-02 + + + [xry111] - Update to meson-0.61.2. Fixes + #5013. + + + [xry111] - Update to linux-5.16.12. Fixes + #5014. + + + [xry111] - Update to MarkupSafe-2.1.0. Fixes + #5015. + + + [xry111] - Update to dbus-1.14.0. Fixes + #5017. + + + [xry111] - Update to vim-8.2.4489 (security fixes). + Addresses #4500. + + + [xry111] - Build libstdc++ in GCC pass 2, and remove the + seperate libstdc++ pass 2. + + + [xry111] - Remove unneeded + --enable-64bit for tcl. + + + + 2022-03-01 diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index 817e3e4c8..fe9b3b278 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -11,10 +11,6 @@ What's new since the last release - In this version of LFS, there has been a major reorganization - of the book using techniques that avoid changing the host system - and provides a more straight forward build process. - Below is a list of package updates made since the previous release of the book. @@ -39,153 +35,153 @@ - + + + + + - + - + - + + + - + + - - Gawk-&gawk-version; - + - + - + - - - + + + - + + - - - + + + - + Linux-&linux-version; - - - Man-DB-&man-db-version; - + - + Meson-&meson-version; @@ -195,19 +191,19 @@ - + - + - - + + - + + - + + - - Tcl-&tcl-version; - + - + + Vim-&vim-version; @@ -267,9 +263,9 @@ - + - - binutils-2.38-lto_fix-1.patch - - - coreutils-9.0-chmod_fix-1.patch - - - file-5.40-upstream_fixes-1.patch - - - shadow-4.10-useradd_segfault-1.patch - - - sysvinit-3.01-consolidated-1.patch - - - systemd-250-upstream_fixes-1.patch - diff --git a/chapter05/libstdc++.xml b/chapter05/libstdc++.xml index b24688c04..1311fadab 100644 --- a/chapter05/libstdc++.xml +++ b/chapter05/libstdc++.xml @@ -5,8 +5,8 @@ %general-entities; ]> - - + + gcc-libstdc++ @@ -14,9 +14,9 @@
&gcc-url;
- Libstdc++ from GCC-&gcc-version;, Pass 1 + Libstdc++ from GCC-&gcc-version; - + GCC tools, libstdc++ pass 1 diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml index ad6c8a0b2..b901718d8 100644 --- a/chapter06/gcc-pass2.xml +++ b/chapter06/gcc-pass2.xml @@ -64,26 +64,30 @@ mv -v mpc-&mpc-version; mpc ;; esac - Change the default directory name for + Change the default directory name for the libraries: sed -e '/m64=/s/lib64/lib/' \ -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ -i.orig gcc/config/i386/t-linux64 - + + + Fix an issue causing failure cross-compiling libstdc++: + +sed 's/gnu++17/& -nostdinc++/' \ + -i libstdc++-v3/src/c++17/Makefile.in + + Override the building rule of libgcc and libstdc++ headers, to + allow building these libraries with POSIX threads support: + +sed '/thread_header =/s/@.*@/gthr-posix.h/' \ + -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in + Create a separate build directory again: mkdir -v build cd build - Create a symlink that allows libgcc to be built with posix threads - support: - -mkdir -pv $LFS_TGT/libgcc -ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h - Before starting to build GCC, remember to unset any environment variables that override the default optimization flags. @@ -92,8 +96,9 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h../configure \ --build=$(../config.guess) \ --host=$LFS_TGT \ + --target=$LFS_TGT \ + LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ --prefix=/usr \ - CC_FOR_TARGET=$LFS_TGT-gcc \ --with-build-sysroot=$LFS \ --enable-initfini-array \ --disable-nls \ @@ -104,7 +109,6 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h mlist=m64,m32The meaning of the new configure options: - -with-build-sysroot=$LFS + --with-build-sysroot=$LFS Normally, using --host ensures that a cross-compiler is used for building GCC, and that compiler knows @@ -144,6 +148,33 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h + + --target=$LFS_TGT + + As we are cross-compiling GCC, it's impossible to build + target libraries (libgcc + and libstdc++) with the + compiled GCC binaries because these binaries won't run on the + host distro. GCC building system will attempt to use the + C and C++ compilers on the host distro as a workaround by default. + It's not supported to build GCC target libraries with a different + version of GCC, so using host compilers may cause building + failure. This parameter ensures to build the libraries with GCC + pass 1 and prevent the issue. + + + + + LDFLAGS_FOR_TARGET=... + + Allow libstdc++ to + use shared libgcc being + built in this pass, instead of the static version built in GCC + pass 1. This is needed for supporting C++ exception + handling. + + + --enable-initfini-array diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml index 8c78f230a..362980dda 100644 --- a/chapter07/chapter07.xml +++ b/chapter07/chapter07.xml @@ -17,7 +17,6 @@ - diff --git a/chapter07/libstdc++-pass2.xml b/chapter07/libstdc++-pass2.xml deleted file mode 100644 index 328e60a07..000000000 --- a/chapter07/libstdc++-pass2.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - %general-entities; -]> - - - - - - gcc-libstdc++ - &gcc-version; -
&gcc-url;
-
- - Libstdc++ from GCC-&gcc-version;, Pass 2 - - - GCC - tools, libstdc++ pass 2 - - - - - - <para>When building <xref linkend="ch-tools-gcc-pass2"/> we had to defer - the installation of the C++ standard library because no suitable compiler - was available to compile it. We could not use the compiler built in that - section because it is a native compiler and should not be used outside of - chroot and risks polluting the libraries with some host components.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&libstdcpp-tmpp2-sbu;</seg> - <seg>&libstdcpp-tmpp2-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Target Libstdc++ - - - Libstdc++ is part of the GCC sources. - You should first unpack the GCC tarball and change to the - gcc-&gcc-version; directory. - - - Create a link which exists when building libstdc++ in the gcc tree: - -ln -s gthr-posix.h libgcc/gthr-default.h - - Create a separate build directory for libstdc++ and enter it: - -mkdir -v build -cd build - - Prepare libstdc++ for compilation: - -../libstdc++-v3/configure \ - CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ - --prefix=/usr \ - --disable-multilib \ - --disable-nls \ - --host=$(uname -m)-lfs-linux-gnu \ - --disable-libstdcxx-pch -../libstdc++-v3/configure \ - CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ - --prefix=/usr \ - --enable-multilib \ - --disable-nls \ - --host=$(uname -m)-lfs-linux-gnu \ - --disable-libstdcxx-pch - - - The meaning of the configure options: - - - CXXFLAGS="-g -O2 -D_GNU_SOURCE" - - These flags are passed by the top level Makefile when doing - a full build of GCC. - - - - - --host=$(uname -m)-lfs-linux-gnu - - We have to mimic what would happen if this package were built - as part of a full compiler build. This switch would be passed to - configure by GCC's build machinery. - - - - - --disable-libstdcxx-pch - - This switch prevents the installation of precompiled - include files, which are not needed at this stage. - - - - - --enable-multilib - - This switch is set by default but it is added here - explicitly for documentary purpose. The libstdc++ libraries - will be built for every arch (m64, m32, mx32) which are - made available in . - - - - - - Compile libstdc++ by running: - -make - - Install the library: - -make install - - - - - - - <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter08/adjusting.xml b/chapter08/adjusting.xml deleted file mode 100644 index 7d01dcfb6..000000000 --- a/chapter08/adjusting.xml +++ /dev/null @@ -1,126 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-adjusting"> - <?dbhtml filename="adjusting.html"?> - - <title>Adjusting the Toolchain - - Now that the final C libraries have been installed, it is time to adjust - the toolchain so that it will link any - newly compiled program against these new libraries. - - First, backup the /tools linker, - and replace it with the adjusted linker we made in chapter 5. We'll also create - a link to its counterpart in - /tools/$(uname -m)-pc-linux-gnu/bin: - -mv -v /tools/bin/{ld,ld-old} -mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old} -mv -v /tools/bin/{ld-new,ld} -ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/bin/ld - - the next command amends the GCC specs file to achieve three goals: - first point GCC to the new dynamic linker. Simply deleting all instances of - /tools should leave us with the correct path to the dynamic - linker. Second, let GCC know where to find the Glibc start files. Third, - add the /usr/include directory at the end of the default search path, so - that header files added in chapter 6 are found. - A sed command accomplishes this: - -gcc -dumpspecs | sed -e 's@/tools@@g' \ - -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ - -e '/\*cpp:/{n;s@$@ -idirafter /usr/include@}' > \ - `dirname $(gcc --print-libgcc-file-name)`/specs - - It is a good idea to visually inspect the specs file to verify the - intended change was actually made. - - It is imperative at this point to ensure that the basic - functions (compiling and linking) of the adjusted toolchain are working - as expected. To do this, perform the following sanity checks: - -echo 'int main(){}' > dummy.c -cc dummy.c -v -Wl,--verbose &> dummy.log -readelf -l a.out | grep ': /lib' - - There should be no errors, - and the output of the last command will be (allowing for - platform-specific differences in the dynamic linker name): - -[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] - - Note that on 64-bit systems /lib is - the location of our dynamic linker, but is accessed via a symbolic link - in /lib64. - - On 32-bit systems the interpreter should be - /lib/ld-linux.so.2. - - Now make sure that we're setup to use the correct start files: - -grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log - - The output of the last command should be: - -/usr/lib/../lib/crt1.o succeeded -/usr/lib/../lib/crti.o succeeded -/usr/lib/../lib/crtn.o succeeded - - Verify that the compiler is searching for the correct header - files: - -grep -B4 '^ /usr/include' dummy.log - - This command should return the following output: - -#include <...> search starts here: - /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include - /tools/include - /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed - /usr/include - - On a 32 bit system, x86_64 is replaced with i686. - - Next, verify that the new linker is being used with the correct search paths: - -grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' - - References to paths that have components with '-linux-gnu' should - be ignored, but otherwise the output of the last command should be: - -SEARCH_DIR("/usr/lib") -SEARCH_DIR("/lib") - - Next make sure that we're using the correct libc: - -grep "/lib.*/libc.so.6 " dummy.log - - The output of the last command should be: - -attempt to open /usr/lib/libc.so.6 succeeded - - Make sure GCC is using the correct dynamic linker: - -grep found dummy.log - - The output of the last command should be (allowing for - platform-specific differences in dynamic linker name): - -found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2 - - If the output does not appear as shown above or is not received - at all, then something is seriously wrong. Investigate and retrace the - steps to find out where the problem is and correct it. Any - issues will need to be resolved before continuing with the process. - - Once everything is working correctly, clean up the test files: - -rm -v dummy.c a.out dummy.log - -
diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index 314f98980..ac58693d7 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -215,29 +215,21 @@ rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/ - +echo 'int main(){}' > dummy.c +cc dummy.c -v -Wl,--verbose &> dummy.log +readelf -l a.out | grep ': /lib' - + There should be no errors, + and the output of the last command will be (allowing for + platform-specific differences in the dynamic linker name): - +[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] - + Now make sure that we're setup to use the correct start files: - +grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log - + The output of the last command should be: /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crt1.o succeeded /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded @@ -250,15 +242,12 @@ rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/crt*.o files under the /usr/lib directory.
- + Verify that the compiler is searching for the correct header + files: grep -B4 '^ /usr/include' dummy.log - + This command should return the following output: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include @@ -269,17 +258,12 @@ rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/Again, the directory named after your target triplet may be different than the above, depending on your system architecture. - + Next, verify that the new linker is being used with the correct search paths: - +grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' - + References to paths that have components with '-linux-gnu' should + be ignored, but otherwise the output of the last command should be: SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64") SEARCH_DIR("/usr/local/lib64") @@ -303,49 +287,32 @@ SEARCH_DIR("/usr/local/lib") SEARCH_DIR("/lib") SEARCH_DIR("/usr/lib"); - + Next make sure that we're using the correct libc: - +grep "/lib.*/libc.so.6 " dummy.log - + The output of the last command should be: - +attempt to open /usr/lib/libc.so.6 succeeded - + Make sure GCC is using the correct dynamic linker: - +grep found dummy.log - + The output of the last command should be (allowing for + platform-specific differences in dynamic linker name): - +found ld-linux-x86-64.so.2 at /usr/lib/ld-linux-x86-64.so.2 - + If the output does not appear as shown above or is not received + at all, then something is seriously wrong. Investigate and retrace the + steps to find out where the problem is and correct it. Any + issues will need to be resolved before continuing with the process. - + Once everything is working correctly, clean up the test files: - +rm -v dummy.c a.out dummy.log Finally, move a misplaced file: diff --git a/chapter08/iproute2.xml b/chapter08/iproute2.xml index d70aaa6bf..25e7e81be 100644 --- a/chapter08/iproute2.xml +++ b/chapter08/iproute2.xml @@ -61,7 +61,7 @@ rm -fv man/man8/arpd.8 --> Compile the package: -make +make NETNS_RUN_DIR=/run/netns This package does not have a working test suite. - + - + - - + +