Browse Source

Introduce -isystem to use the final system location of gcc's internel headers in the GlibC build.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11250 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
DJ Lucas 7 years ago
parent
commit
0967c907bc
4 changed files with 39 additions and 13 deletions
  1. 4 0
      chapter01/changelog.xml
  2. 1 1
      chapter06/createfiles.xml
  3. 5 0
      chapter06/gcc.xml
  4. 29 12
      chapter06/glibc.xml

+ 4 - 0
chapter01/changelog.xml

@@ -45,6 +45,10 @@
     <listitem>
       <para>2017-05-13</para>
       <itemizedlist>
+        <listitem>
+          <para>[dj] - Introduce -isystem to use the final system location of
+          gcc's internel headers in the GlibC build.</para>
+        </listitem>
         <listitem>
           <para>[ken] - Update some library versions in Stripping Again, partly
           fixes <ulink url="&lfs-ticket-root;4085">#4085</ulink>.</para>

+ 1 - 1
chapter06/createfiles.xml

@@ -169,7 +169,7 @@ ln -sv bash /bin/sh</userinput></screen>
     <varlistentry revision="systemd">
       <term><parameter><filename>/usr/lib/lib{blkid,lzma,mount,uuid}.{a,la,so*}</filename></parameter></term>
       <listitem>
-        <para>These links prevent systemd utilties from being poluted with an
+        <para>These links prevent systemd utilities from being acquiring an
         unnecessary reference to the
         <filename class="directory">/tools</filename> directory.</para>
       </listitem>

+ 5 - 0
chapter06/gcc.xml

@@ -51,6 +51,11 @@
   ;;
 esac</userinput></screen>
 
+    <para>Remove the symlink created earlier as the final gcc includes will be
+    installed here:</para>
+
+<screen><userinput remap="pre">rm -f /usr/lib/gcc</userinput></screen>
+
     <para>The GCC documentation recommends building GCC in a dedicated build directory:</para>
 
 <screen><userinput remap="pre">mkdir -v build

+ 29 - 12
chapter06/glibc.xml

@@ -57,14 +57,21 @@
 
 <screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
 
-    <para>Create a symlink for LSB compliance and, for x86_64, a
-    compatibility symlink required for the dynamic loader to function
-    correctly:</para>
+    <para>First create a compatibility symlink to avoid references to /tools in
+    our final glibc:</para>
+
+<screen><userinput remap="pre">ln -sfv /tools/lib/gcc /usr/lib</userinput></screen>
+
+    <para>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:</para>
 
 <screen><userinput remap="pre">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</userinput></screen>
@@ -77,15 +84,25 @@ cd       build</userinput></screen>
 
     <para>Prepare Glibc for compilation:</para>
 
-<screen><userinput remap="configure">../configure --prefix=/usr                   \
-             --disable-werror                \
-             --enable-kernel=&min-kernel;          \
-             --enable-obsolete-rpc           \
-             --enable-stack-protector=strong \
-             libc_cv_slibdir=/lib</userinput></screen>
+<screen><userinput remap="configure">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</userinput></screen>
 
    <variablelist>
-      <title>The meaning of the new configure options:</title>
+      <title>The meaning of the options and new configure parameters:</title>
+
+      <varlistentry>
+        <term><parameter>CC="gcc -isystem $GCC_INCDIR -isystem /usr/include"</parameter></term>
+        <listitem>
+          <para>Setting the location of both gcc and system include directories
+          avoids introduction of invalid paths in debuging symbols.</para>
+        </listitem>
+      </varlistentry>
 
       <varlistentry>
         <term><parameter>--disable-werror</parameter></term>