diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 7f03521a0..f67a442ba 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -45,6 +45,10 @@ 2017-05-13 + + [dj] - Introduce -isystem to use the final system location of + gcc's internel headers in the GlibC build. + [ken] - Update some library versions in Stripping Again, partly fixes #4085. diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml index 99cc0da9f..1dabbbbfd 100644 --- a/chapter06/createfiles.xml +++ b/chapter06/createfiles.xml @@ -169,7 +169,7 @@ ln -sv bash /bin/sh /usr/lib/lib{blkid,lzma,mount,uuid}.{a,la,so*} - These links prevent systemd utilties from being poluted with an + These links prevent systemd utilities from being acquiring an unnecessary reference to the /tools directory. diff --git a/chapter06/gcc.xml b/chapter06/gcc.xml index 47f96f720..b8fa2a327 100644 --- a/chapter06/gcc.xml +++ b/chapter06/gcc.xml @@ -51,6 +51,11 @@ ;; esac + Remove the symlink created earlier as the final gcc includes will be + installed here: + +rm -f /usr/lib/gcc + The GCC documentation recommends building GCC in a dedicated build directory: mkdir -v build diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index 5d2afcd81..d43853431 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -57,14 +57,21 @@ patch -Np1 -i ../&glibc-fhs-patch; - Create a symlink for LSB compliance and, for x86_64, a - compatibility symlink required for the dynamic loader to function - correctly: + First create a compatibility symlink to avoid references to /tools in + our final glibc: + +ln -sfv /tools/lib/gcc /usr/lib + + Determine the GCC include directory and create a symlink for LSB + compliance. Additionally, for x86_64, create a compatibility symlink + required for the dynamic loader to function correctly: case $(uname -m) in - x86) ln -s ld-linux.so.2 /lib/ld-lsb.so.3 + x86) GCC_INCDIR=/usr/lib/gcc/x86-pc-linux-gnu/&gcc-version;/include + ln -s ld-linux.so.2 /lib/ld-lsb.so.3 ;; - x86_64) ln -s ../lib/ld-linux-x86-64.so.2 /lib64 + x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include + ln -s ../lib/ld-linux-x86-64.so.2 /lib64 ln -s ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 ;; esac @@ -77,15 +84,25 @@ cd build Prepare Glibc for compilation: -../configure --prefix=/usr \ - --disable-werror \ - --enable-kernel=&min-kernel; \ - --enable-obsolete-rpc \ - --enable-stack-protector=strong \ - libc_cv_slibdir=/lib +CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" \ +../configure --prefix=/usr \ + --disable-werror \ + --enable-kernel=&min-kernel; \ + --enable-obsolete-rpc \ + --enable-stack-protector=strong \ + libc_cv_slibdir=/lib +unset GCC_INCDIR - The meaning of the new configure options: + The meaning of the options and new configure parameters: + + + CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" + + Setting the location of both gcc and system include directories + avoids introduction of invalid paths in debuging symbols. + + --disable-werror