On 08/07/2016 04:04 PM, William Harrington wrote:
On Sun, 07 Aug 2016 15:11:26 -0500
DJ Lucas <[email protected]> wrote:

Also, with AMD64, some targets will still install their libs into
lib64. Example is e2fsprogs.

Interesting, I didn't see this on the initial build. /lib64 was empty, and 
/usr/lib64 didn't exist. Maybe I broke something and just didn't catch it, but 
it seemed reasonably sane which is why I continued. I didn't mess with it for 
more than a couple of hours before starting on book changes and rebuild.

My mistake, E2fsprogs doesn't install into lib64, It will always install to lib 
unless changing the configure file. Your build was right.


OK, this appears to be working as expected. Again, this is adapted from pure64, just replaced the patches with seds, and added ld-lsb* symlinks (and the ld-linux-x86_64).

diff -Naurp lfs-20160806/chapter05/binutils-pass1.xml 
lfs-20160806-no-lib64-symlinks/chapter05/binutils-pass1.xml
--- lfs-20160806/chapter05/binutils-pass1.xml   2016-05-31 21:52:10.639626000 
-0500
+++ lfs-20160806-no-lib64-symlinks/chapter05/binutils-pass1.xml 2016-08-06 
11:52:13.967870649 -0500
@@ -146,13 +146,6 @@ cd       build</userinput></screen>
     tests at this point are minimal since the programs from this
     first pass will soon be replaced by those from the second.</para>
 
-    <para>If building on x86_64, create a symlink to ensure the sanity of
-    the toolchain:</para>
-
-<screen><userinput remap="install">case $(uname -m) in
-  x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
-esac</userinput></screen>
-
     <para>Install the package:</para>
 
 <screen><userinput remap="install">make install</userinput></screen>
diff -Naurp lfs-20160806/chapter05/gcc-pass1.xml 
lfs-20160806-no-lib64-symlinks/chapter05/gcc-pass1.xml
--- lfs-20160806/chapter05/gcc-pass1.xml        2016-05-31 21:52:10.639626000 
-0500
+++ lfs-20160806-no-lib64-symlinks/chapter05/gcc-pass1.xml      2016-08-07 
11:52:27.250303088 -0500
@@ -68,19 +68,32 @@ mv -v mpc-&mpc-version; mpc</userinput><
     class="directory">/usr/include</filename> from GCC's include search path.
     Issue:</para>
 
-<screen><userinput remap="pre">for file in \
- $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
+<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
 do
   cp -uv $file{,.orig}
   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
+  case $(uname -m) in
+    x86_64)
+      sed -e 's@/lib/@/lib32/@g' \
+          -e 's@/lib64/@/lib/@g' -i $file
+    ;;
+  esac
   echo '
 #undef STANDARD_STARTFILE_PREFIX_1
 #undef STANDARD_STARTFILE_PREFIX_2
 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
 #define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
   touch $file.orig
-done</userinput></screen>
+done
+case $(uname -m) in
+  x86_64)
+    sed -e '/MULTILIB_OSDIRNAMES/s@lib\$@lib32$@' \
+        -e '/MULTILIB_OSDIRNAMES/s@lib64\$@lib$@' \
+        -e '/MULTILIB_OSDIRNAMES/s@,../lib)@)@'  \
+        -i.orig gcc/config/i386/t-linux64
+  ;;
+esac</userinput></screen>
 
     <para>In case the above seems hard to follow, let's break it down a bit.
     First we find all the files under the <filename
@@ -123,6 +136,7 @@ cd       build</userinput></screen>
     --target=$LFS_TGT                              \
     --prefix=/tools                                \
     --with-glibc-version=2.11                      \
+    --with-slibdir=/tools/lib                      \
     --with-sysroot=$LFS                            \
     --with-newlib                                  \
     --without-headers                              \
diff -Naurp lfs-20160806/chapter05/gcc-pass2.xml 
lfs-20160806-no-lib64-symlinks/chapter05/gcc-pass2.xml
--- lfs-20160806/chapter05/gcc-pass2.xml        2016-05-31 21:52:10.639626000 
-0500
+++ lfs-20160806-no-lib64-symlinks/chapter05/gcc-pass2.xml      2016-08-07 
11:53:09.863520082 -0500
@@ -70,19 +70,32 @@ esac</userinput></screen>
     use the one installed in <filename
     class="directory">/tools</filename>.</para>
 
-<screen><userinput remap="pre">for file in \
- $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
+<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
 do
   cp -uv $file{,.orig}
   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
+  case $(uname -m) in
+    x86_64)
+      sed -e 's@/lib/@/lib32/@g' \
+          -e 's@/lib64/@/lib/@g' -i $file
+    ;;
+  esac
   echo '
 #undef STANDARD_STARTFILE_PREFIX_1
 #undef STANDARD_STARTFILE_PREFIX_2
 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
 #define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
   touch $file.orig
-done</userinput></screen>
+done
+case $(uname -m) in
+  x86_64)
+    sed -e '/MULTILIB_OSDIRNAMES/s@lib\$@lib32$@' \
+        -e '/MULTILIB_OSDIRNAMES/s@lib64\$@lib$@' \
+        -e '/MULTILIB_OSDIRNAMES/s@,../lib)@)@'  \
+        -i.orig gcc/config/i386/t-linux64
+  ;;
+esac</userinput></screen>
 
     <para>As in the first build of GCC it requires the GMP, MPFR and MPC
     packages. Unpack the tarballs and move them into the required directory
@@ -117,6 +130,7 @@ RANLIB=$LFS_TGT-ranlib
     --prefix=/tools                                \
     --with-local-prefix=/tools                     \
     --with-native-system-header-dir=/tools/include \
+    --with-slibdir=/tools/lib                      \
     --enable-languages=c,c++                       \
     --disable-libstdcxx-pch                        \
     --disable-multilib                             \
diff -Naurp lfs-20160806/chapter06/creatingdirs.xml 
lfs-20160806-no-lib64-symlinks/chapter06/creatingdirs.xml
--- lfs-20160806/chapter06/creatingdirs.xml     2016-05-31 21:52:10.639626000 
-0500
+++ lfs-20160806-no-lib64-symlinks/chapter06/creatingdirs.xml   2016-08-06 
12:10:45.373547290 -0500
@@ -24,9 +24,7 @@ mkdir -v  /usr/libexec
 mkdir -pv /usr/{,local/}share/man/man{1..8}
 
 case $(uname -m) in
- x86_64) ln -sv lib /lib64
-         ln -sv lib /usr/lib64
-         ln -sv lib /usr/local/lib64 ;;
+ x86_64) mkdir -v /lib64 ;;
 esac
 
 mkdir -v /var/{log,mail,spool}
diff -Naurp lfs-20160806/chapter06/gcc.xml 
lfs-20160806-no-lib64-symlinks/chapter06/gcc.xml
--- lfs-20160806/chapter06/gcc.xml      2016-08-05 22:53:06.385717000 -0500
+++ lfs-20160806-no-lib64-symlinks/chapter06/gcc.xml    2016-08-07 
04:26:57.297934017 -0500
@@ -45,6 +45,23 @@
 
 <screen><userinput remap="pre">patch -Np1 -i 
../gcc-6.1.0-asan-1.patch</userinput></screen>
 
+    <para>If building on x86_64, change the default library path to
+    <filename>/lib,/usr/lib</filename>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+  x86_64)
+    for file in gcc/config/{linux,i386/linux{,64}}.h
+    do
+      sed -e 's@/lib/@/lib32/@g' \
+          -e 's@/lib64/@/lib/@g' -i $file
+    done
+    sed -e '/MULTILIB_OSDIRNAMES/s@lib\$@lib32$@' \
+        -e '/MULTILIB_OSDIRNAMES/s@lib64\$@lib$@' \
+        -e '/MULTILIB_OSDIRNAMES/s@,../lib)@)@'  \
+        -i.orig gcc/config/i386/t-linux64
+  ;;
+esac</userinput></screen>
+
     <para>The GCC documentation recommends building GCC in a dedicated build 
directory:</para>
 
 <screen><userinput remap="pre">mkdir -v build
diff -Naurp lfs-20160806/chapter06/glibc.xml 
lfs-20160806-no-lib64-symlinks/chapter06/glibc.xml
--- lfs-20160806/chapter06/glibc.xml    2016-08-06 10:00:51.603661000 -0500
+++ lfs-20160806-no-lib64-symlinks/chapter06/glibc.xml  2016-08-07 
18:20:19.239462652 -0500
@@ -57,6 +57,15 @@
 
 <screen><userinput remap="pre">patch -Np1 -i 
../&glibc-fhs-patch;</userinput></screen>
 
+    <para>If building on x86_64, enusre that the <command>ldd</command> script
+    uses the dynamic linker in <filename>/lib</filename>:</para>
+
+<screen><userinput remap="pre">case $(uname -m) in
+  x86_64)
+    sed -i '/RTLDLIST/d' $(find ${srcdir}/ -name ldd-rewrite.sed)
+  ;;
+esac</userinput></screen>
+
     <para>The Glibc documentation recommends building Glibc 
     in a dedicated build directory:</para>
 
@@ -67,7 +76,8 @@ cd       build</userinput></screen>
 
 <screen><userinput remap="configure">../configure --prefix=/usr          \
              --enable-kernel=&min-kernel; \
-             --enable-obsolete-rpc</userinput></screen>
+             --enable-obsolete-rpc        \
+             libc_cv_slibdir=/lib</userinput></screen>
 
     <para>Compile the package:</para>
 
@@ -198,6 +208,17 @@ localedef -i zh_CN -f GB18030 zh_CN.GB18
     <filename>glibc-&glibc-version;/localedata/SUPPORTED</filename> file
     in the unlikely case you need them.</para>
 
+    <para>Finally, create a symlink for LSB compliance and, for x86_64, a
+    compatibility symlink required by many binary programs:</para>
+
+<screen><userinput remap="install">case $(uname -m) in
+    x86) ln -s ld-linux.so.2 /lib/ld-lsb.so.3
+    ;;
+    x86_64) 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>
+
   </sect2>
 
   <sect2 id="conf-glibc" role="configuration">
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to