Changeset b3f1ebb3 for chapter05


Ignore:
Timestamp:
03/31/2021 10:41:31 AM (3 years ago)
Author:
Xℹ Ruoyao <xry111@…>
Branches:
ml-11.0, multilib
Children:
6702623
Parents:
989524c
git-author:
Thomas Trepl <thomas@…> (04/01/2019 05:00:45 PM)
git-committer:
Xℹ Ruoyao <xry111@…> (03/31/2021 10:41:31 AM)
Message:

First apply of multilib-patch of April 1st, 2019

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11566 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Location:
chapter05
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • chapter05/binutils-pass1.xml

    r989524c rb3f1ebb3  
    7373    <para>Now prepare Binutils for compilation:</para>
    7474
    75 <screen><userinput remap="configure">../configure --prefix=/tools            \
     75<screen arch="default"><userinput remap="configure">../configure --prefix=/tools            \
    7676             --with-sysroot=$LFS        \
    7777             --with-lib-path=/tools/lib \
     
    7979             --disable-nls              \
    8080             --disable-werror</userinput></screen>
     81
     82    <screen arch="multilib"><userinput remap="configure">../configure --prefix=/tools \
     83             --with-sysroot=$LFS                     \
     84             --with-lib-path=/tools/lib:/tools/lib32:/tools/libx32 \
     85             --target=$LFS_TGT                       \
     86             --disable-nls                           \
     87             --disable-werror                        \
     88             --enable-64-bit-bfd                     \
     89             --enable-multilib</userinput></screen>
    8190
    8291    <variablelist>
     
    147156    first pass will soon be replaced by those from the second.</para>
    148157
    149     <para>If building on x86_64, create a symlink to ensure the sanity of
     158    <para arch="default">If building on x86_64, create a symlink to ensure the
     159    sanity of the toolchain:</para>
     160
     161    <para arch="multilib">Create a symlink to ensure the sanity of
    150162    the toolchain:</para>
    151163
    152 <screen><userinput remap="install">case $(uname -m) in
     164<screen arch="default"><userinput remap="install">case $(uname -m) in
    153165  x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
    154166esac</userinput></screen>
     167
     168<screen arch="multilib"><userinput remap="install">mkdir -v /tools/lib &amp;&amp;
     169ln -sv lib /tools/lib64</userinput></screen>
    155170
    156171    <para>Install the package:</para>
  • chapter05/binutils-pass2.xml

    r989524c rb3f1ebb3  
    5151    <para>Prepare Binutils for compilation:</para>
    5252
    53 <screen><userinput remap="configure">CC=$LFS_TGT-gcc                \
     53<screen arch="default"><userinput remap="configure">CC=$LFS_TGT-gcc                \
    5454AR=$LFS_TGT-ar                 \
    5555RANLIB=$LFS_TGT-ranlib         \
     
    6060    --with-lib-path=/tools/lib \
    6161    --with-sysroot</userinput></screen>
     62
     63<screen arch="multilib"><userinput remap="configure">CC=$LFS_TGT-gcc                \
     64AR=$LFS_TGT-ar                 \
     65RANLIB=$LFS_TGT-ranlib         \
     66../configure                   \
     67    --prefix=/tools            \
     68    --disable-nls              \
     69    --disable-werror           \
     70    --with-lib-path=/tools/lib:/tools/lib32:/tools/libx32 \
     71    --with-sysroot             \
     72    --enable-64-bit-bfd        \
     73    --enable-multilib</userinput></screen>
    6274
    6375    <variablelist>
     
    7385      </varlistentry>
    7486
    75       <varlistentry>
     87      <varlistentry arch="default">
    7688        <term><parameter>--with-lib-path=/tools/lib</parameter></term>
    7789        <listitem>
     
    7991          search path during the compilation of Binutils, resulting in
    8092          <filename class="directory">/tools/lib</filename> being passed
     93          to the linker. This prevents the linker from searching through
     94          library directories on the host.</para>
     95        </listitem>
     96      </varlistentry>
     97
     98      <varlistentry arch="multilib">
     99        <term><parameter>--with-lib-path=/tools/lib:...</parameter></term>
     100        <listitem>
     101          <para>This tells the configure script to specify the library
     102          search path during the compilation of Binutils, resulting in
     103          <filename class="directory">/tools/lib</filename>,
     104          <filename class="directory">/tools/lib32</filename> and
     105          <filename class="directory">/tools/libx32</filename> being passed
    81106          to the linker. This prevents the linker from searching through
    82107          library directories on the host.</para>
     
    94119      </varlistentry>
    95120
     121      <varlistentry arch="multilib">
     122        <term><parameter>--enable-64-bit-bfd</parameter></term>
     123        <listitem>
     124          <para>TODO</para>
     125        </listitem>
     126      </varlistentry>
     127     
     128      <varlistentry arch="multilib">
     129        <term><parameter>--enable-multilib</parameter></term>
     130        <listitem>
     131          <para>TODO</para>
     132        </listitem>
     133      </varlistentry>
     134     
    96135    </variablelist>
    97136
     
    107146    the next chapter:</para>
    108147
    109 <screen><userinput remap="adjust">make -C ld clean
     148<screen arch="default"><userinput remap="adjust">make -C ld clean
    110149make -C ld LIB_PATH=/usr/lib:/lib
     150cp -v ld/ld-new /tools/bin</userinput></screen>
     151
     152<screen arch="multilib"><userinput remap="adjust">make -C ld clean
     153make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32:/usr/libx32:/libx32
    111154cp -v ld/ld-new /tools/bin</userinput></screen>
    112155
  • chapter05/chapter05.xml

    r989524c rb3f1ebb3  
    2121  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/>
    2222  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass2.xml"/>
     23  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zlib.xml"/>
    2324  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/>
    2425  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
  • chapter05/gcc-pass1.xml

    r989524c rb3f1ebb3  
    4444    <title>Installation of Cross GCC</title>
    4545
    46     <para>GCC now requires the GMP, MPFR and MPC packages. As these packages may
    47     not be included in your host distribution, they will be built with
    48     GCC.  Unpack each package into the GCC source directory and rename the
    49     resulting directories so the GCC build procedures will automatically
    50     use them:</para>
     46    <para arch="default">GCC now requires the GMP, MPFR, and MPC packages. As
     47    these packages may not be included in your host distribution, they will be
     48    built with GCC.  Unpack each package into the GCC source directory and
     49    rename the resulting directories so the GCC build procedures will
     50    automatically use them:</para>
     51
     52    <para arch="multilib">GCC now requires the GMP, ISL, MPFR, and MPC packages.
     53    As these packages may not be included in your host distribution, they will
     54    be built with GCC.  Unpack each package into the GCC source directory and
     55    rename the resulting directories so the GCC build procedures will
     56    automatically use them:</para>
    5157
    5258    <note><para>There are frequent misunderstandings about this chapter.  The
     
    5662    proceed with the instructions below.</para></note>
    5763
    58 <screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
     64<screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
    5965mv -v mpfr-&mpfr-version; mpfr
    6066tar -xf ../gmp-&gmp-version;.tar.xz
     
    6268tar -xf ../mpc-&mpc-version;.tar.gz
    6369mv -v mpc-&mpc-version; mpc</userinput></screen>
     70<screen arch="multilib"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
     71mv -v mpfr-&mpfr-version; mpfr
     72tar -xf ../gmp-&gmp-version;.tar.xz
     73mv -v gmp-&gmp-version; gmp
     74tar -xf ../mpc-&mpc-version;.tar.gz
     75mv -v mpc-&mpc-version; mpc
     76tar -xf ../isl-&isl-version;.tar.xz
     77mv -v isl-&isl-version; isl</userinput></screen>
    6478
    6579    <para>The following command will change the location of GCC's default
     
    7286do
    7387  cp -uv $file{,.orig}
    74   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
     88  sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&amp;@g' \
    7589      -e 's@/usr@/tools@g' $file.orig &gt; $file
    7690  echo '
     
    98112    inadvertently run twice.</para>
    99113
    100     <para>Finally, on x86_64 hosts, set the default directory name for
    101     64-bit libraries to <quote>lib</quote>:</para>
    102 
    103 <screen><userinput remap="pre">case $(uname -m) in
     114    <para arch="default">Finally, on x86_64 hosts, set the default directory
     115    name for 64-bit libraries to <quote>lib</quote>:</para>
     116
     117<screen arch="default"><userinput remap="pre">case $(uname -m) in
    104118  x86_64)
    105119    sed -e '/m64=/s/lib64/lib/' \
     
    108122esac</userinput></screen>
    109123
     124<screen arch="multilib"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
     125    -i.orig gcc/config/i386/t-linux64
     126cat > gcc/config/i386/t-linux64 &lt;&lt;"EOF"
     127comma=,
     128MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
     129MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
     130MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
     131MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-linux-gnu)
     132MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
     133EOF</userinput></screen>
     134
    110135<!--
    111136    <para>GCC doesn't detect stack protection correctly, which causes problems
     
    121146<screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
    122147-->
     148
     149    <!-- Following patch might be obsolete with gcc >= 8.2.1 -->
     150    <!-- see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 -->
     151    <!-- Fix applied in ch5-gcc-pass{1,2}, ch6-gcc -->
     152    <para arch="multilib">Fix an issue with isl-&isl-version;:</para>
     153
     154<screen arch="multilib"><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
     155    -i gcc/graphite.h</userinput></screen>
     156
    123157    <para>The GCC documentation recommends building GCC
    124158    in a dedicated build directory:</para>
     
    129163    <para>Prepare GCC for compilation:</para>
    130164
    131 <screen><userinput remap="configure">../configure                                       \
     165<screen arch="default"><userinput remap="configure">../configure                                       \
    132166    --target=$LFS_TGT                              \
    133167    --prefix=/tools                                \
     
    151185    --disable-libstdcxx                            \
    152186    --enable-languages=c,c++</userinput></screen>
     187
     188<screen arch="multilib"><userinput remap="configure">../configure                                       \
     189    --target=$LFS_TGT                              \
     190    --prefix=/tools                                \
     191    --with-glibc-version=2.11                      \
     192    --with-sysroot=$LFS                            \
     193    --with-newlib                                  \
     194    --without-headers                              \
     195    --with-local-prefix=/tools                     \
     196    --with-native-system-header-dir=/tools/include \
     197    --disable-nls                                  \
     198    --disable-shared                               \
     199    --enable-multilib                              \
     200    --with-multilib-list=m32,m64,mx32              \
     201    --disable-decimal-float                        \
     202    --disable-threads                              \
     203    --disable-libatomic                            \
     204    --disable-libgomp                              \
     205    --disable-libmpx                               \
     206    --disable-libquadmath                          \
     207    --disable-libssp                               \
     208    --disable-libvtv                               \
     209    --disable-libstdcxx                            \
     210    --enable-languages=c,c++</userinput></screen>
     211
    153212    <variablelist>
    154213      <title>The meaning of the configure options:</title>
     
    220279      </varlistentry>
    221280
    222       <varlistentry>
     281      <varlistentry arch="default">
    223282        <term><parameter>--disable-multilib</parameter></term>
    224283        <listitem>
    225284          <para>On x86_64, LFS does not yet support a multilib configuration.
    226285          This switch is harmless for x86.</para>
     286        </listitem>
     287      </varlistentry>
     288
     289      <varlistentry arch="multilib">
     290        <term><parameter>--enable-multilib,
     291                         --with-multilib-list=m32,m64,mx32</parameter></term>
     292        <listitem>
     293          <para>LFS now supports a multilib configuration. Enable it for the
     294          32bit, the 64-bit, and the mixed mode.</para>
    227295        </listitem>
    228296      </varlistentry>
  • chapter05/gcc-pass2.xml

    r989524c rb3f1ebb3  
    7474do
    7575  cp -uv $file{,.orig}
    76   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
     76  sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&amp;@g' \
    7777      -e 's@/usr@/tools@g' $file.orig &gt; $file
    7878  echo '
     
    8484done</userinput></screen>
    8585
    86     <para>If building on x86_64, change the default directory name for 64-bit
    87     libraries to <quote>lib</quote>:</para>
    88 
    89 <screen><userinput remap="pre">case $(uname -m) in
     86    <para arch="default">If building on x86_64, change the default directory
     87    name for 64-bit libraries to <quote>lib</quote>:</para>
     88
     89<screen arch="default"><userinput remap="pre">case $(uname -m) in
    9090  x86_64)
    9191    sed -e '/m64=/s/lib64/lib/' \
     
    9494esac</userinput></screen>
    9595
    96     <para>As in the first build of GCC it requires the GMP, MPFR and MPC
    97     packages. Unpack the tarballs and move them into the required directory
    98     names:</para>
    99 
    100 <screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
     96    <para arch="multilib">Change the default directory name for 64-bit
     97    libraries to <quote>lib</quote>:</para>
     98
     99<screen arch="multilib"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
     100    -i.orig gcc/config/i386/t-linux64
     101cat > gcc/config/i386/t-linux64 &lt;&lt;"EOF"
     102comma=,
     103MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
     104MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
     105MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-linux-gnu)
     106MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-linux-gnu)
     107MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
     108EOF</userinput></screen>
     109
     110    <para arch="default">As in the first build of GCC it requires the GMP,
     111    MPFR, and MPC packages. Unpack the tarballs and move them into the
     112    required directory names:</para>
     113
     114    <para arch="multilib">As in the first build of GCC it requires the GMP,
     115    ISL, MPFR, and MPC packages. Unpack the tarballs and move them into the
     116    required directory names:</para>
     117
     118<screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
    101119mv -v mpfr-&mpfr-version; mpfr
    102120tar -xf ../gmp-&gmp-version;.tar.xz
     
    104122tar -xf ../mpc-&mpc-version;.tar.gz
    105123mv -v mpc-&mpc-version; mpc</userinput></screen>
    106 <!--
    107     <para>As in the first build of GCC, fix a problem identified upstream:</para>
    108 
    109 <screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
    110 -->
     124<screen arch="multilib"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
     125mv -v mpfr-&mpfr-version; mpfr
     126tar -xf ../gmp-&gmp-version;.tar.xz
     127mv -v gmp-&gmp-version; gmp
     128tar -xf ../mpc-&mpc-version;.tar.gz
     129mv -v mpc-&mpc-version; mpc
     130tar -xf ../isl-&isl-version;.tar.xz
     131mv -v isl-&isl-version; isl</userinput></screen>
     132
     133    <!-- Following patch might be obsolete with gcc >= 8.2.1 -->
     134    <para arch="multilib">Fix an issue with isl-&isl-version;:</para>
     135
     136<screen arch="multilib"><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
     137    -i gcc/graphite.h</userinput></screen>
     138
    111139    <para>Create a separate build directory again:</para>
    112140
     
    119147    <para>Now prepare GCC for compilation:</para>
    120148
    121 <screen><userinput remap="configure">CC=$LFS_TGT-gcc                                    \
     149<screen arch="default"><userinput remap="configure">CC=$LFS_TGT-gcc                                    \
    122150CXX=$LFS_TGT-g++                                   \
    123151AR=$LFS_TGT-ar                                     \
     
    130158    --disable-libstdcxx-pch                        \
    131159    --disable-multilib                             \
     160    --disable-bootstrap                            \
     161    --disable-libgomp</userinput></screen>
     162
     163<screen arch="multilib"><userinput remap="configure">CC=$LFS_TGT-gcc                                    \
     164CXX=$LFS_TGT-g++                                   \
     165AR=$LFS_TGT-ar                                     \
     166RANLIB=$LFS_TGT-ranlib                             \
     167../configure                                       \
     168    --prefix=/tools                                \
     169    --with-local-prefix=/tools                     \
     170    --with-native-system-header-dir=/tools/include \
     171    --enable-languages=c,c++                       \
     172    --disable-libstdcxx-pch                        \
     173    --enable-multilib                              \
     174    --with-multilib-list=m32,m64,mx32              \
     175    --with-system-zlib                             \
    132176    --disable-bootstrap                            \
    133177    --disable-libgomp</userinput></screen>
     
    200244<screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
    201245
    202     <para>Note that the dynamic linker will be /tools/lib/ld-linux.so.2
    203     for 32-bit machines.</para>
     246
     247    <para arch="multilib">Repeat the test for 32-bit:</para>
     248
     249<screen arch="multilib"><userinput>cc -m32 dummy.c
     250readelf -l a.out | grep ': /tools'</userinput></screen>
     251
     252    <para arch="multilib">In this case, the output shoud be:</para>
     253
     254<screen arch="multilib"><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
     255
     256    <para arch="multilib">Repeat the test for x32-bit:</para>
     257
     258<screen arch="multilib"><userinput>cc -mx32 dummy.c
     259readelf -l a.out | grep ': /tools'</userinput></screen>
     260
     261    <para arch="multilib">In this case, the output shoud be:</para>
     262
     263<screen arch="multilib"><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux-x32.so.2]</computeroutput></screen>
     264
     265    <para arch="default">Note that the dynamic linker will be
     266    /tools/lib/ld-linux.so.2 for 32-bit machines.</para>
    204267
    205268    <para>If the output is not shown as above or there was no output at all,
  • chapter05/glibc.xml

    r989524c rb3f1ebb3  
    8383      </varlistentry>
    8484
     85      <varlistentry arch="multilib">
     86        <term><parameter>--enable-multi-arch</parameter></term>
     87        <listitem>
     88          <para>Enables glibc for multiarch environments.</para>
     89        </listitem>
     90      </varlistentry>
     91
    8592      <varlistentry>
    8693        <term><parameter>--with-headers=/tools/include</parameter></term>
     
    185192  </sect2>
    186193
     194  <sect2 arch="multilib" role="installation">
     195    <title>Installation of Glibc 32-bit</title>
     196
     197    <para>Clean the build directory for redoing glibc for 32-bit:</para>
     198<screen><userinput remap="pre">mkdir ../build32
     199cd ../build32</userinput></screen>
     200
     201    <para>Rebuild glibc for 32-bit:</para>
     202<screen><userinput remap="configure">echo slibdir=/tools/lib32 &gt; configparms
     203BUILD_CC="gcc -m32"               \
     204CC="${LFS_TGT}-gcc -m32"          \
     205CXX="${LFS_TGT}-g++ -m32"         \
     206AR="${LFS_TGT}-ar"                \
     207RANLIB="${LFS_TGT}-ranlib"        \
     208../configure --prefix=/tools                    \
     209             --build=$(../scripts/config.guess) \
     210             --host=${LFS_TGT32}                \
     211             --enable-kernel=&min-kernel;             \
     212             --enable-multi-arch                \
     213             --libdir=/tools/lib32              \
     214             --libexecdir=/tools/lib32          \
     215             --with-headers=/tools/include      \
     216             --with-binutils=/tools/bin         \
     217             libc_cv_forced_unwind=yes          \
     218             libc_cv_c_cleanup=yes</userinput></screen>
     219
     220    <para>Now compile the 32-bit version of glibc:</para>
     221<screen><userinput remap="make">make</userinput></screen>
     222
     223    <para>Install 32-bit version of glibc:</para>
     224<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
     225install -vdm755 /tools/lib32
     226cp -Rv DESTDIR/tools/lib32/* /tools/lib32
     227install -vm644 DESTDIR/tools/include/gnu/{lib-names,stubs}-32.h \
     228               /tools/include/gnu/
     229ln -svf /tools/lib32/ld-linux.so.2 /tools/lib/
     230cd ..</userinput></screen>
     231
     232  </sect2>
     233
     234  <sect2 arch="multilib" role="installation">
     235    <title>Installation of Glibc x32-bit</title>
     236
     237    <para>Create a build directory for redoing glibc for x32-bit:</para>
     238<screen><userinput remap="pre">mkdir build32x
     239cd build32x</userinput></screen>
     240
     241    <para>Rebuild glibc for x32-bit:</para>
     242<screen><userinput remap="configure">echo slibdir=/tools/libx32 &gt; configparms
     243BUILD_CC="gcc -mx32"              \
     244CC="${LFS_TGT}-gcc -mx32"         \
     245CXX="${LFS_TGT}-g++ -mx32"        \
     246AR="${LFS_TGT}-ar"                \
     247RANLIB="${LFS_TGT}-ranlib"        \
     248../configure --prefix=/tools                    \
     249             --build=$(../scripts/config.guess) \
     250             --host=${LFS_TGTX32}               \
     251             --enable-kernel=&min-kernel;             \
     252             --enable-multi-arch                \
     253             --libdir=/tools/libx32             \
     254             --libexecdir=/tools/libx32         \
     255             --with-headers=/tools/include      \
     256             --with-binutils=/tools/bin         \
     257             libc_cv_forced_unwind=yes          \
     258             libc_cv_c_cleanup=yes</userinput></screen>
     259
     260    <para>Now compile the x32-bit version of glibc:</para>
     261<screen><userinput remap="make">make</userinput></screen>
     262
     263    <para>Install x32-bit version of glibc:</para>
     264<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
     265install -vdm755 /tools/libx32
     266cp -Rv DESTDIR/tools/libx32/* /tools/libx32
     267install -vm644 DESTDIR/tools/include/gnu/lib-names-x32.h \
     268               /tools/include/gnu/
     269[ -e DESTDIR/tools/include/gnu/stubs-x32.h ] \
     270  &amp;&amp; install -vm644 DESTDIR/tools/include/gnu/stubs-x32.h /tools/include/gnu/ \
     271  || ln -v /tools/include/gnu/stubs-64.h /tools/include/gnu/stubs-x32.h
     272ln -svf /tools/libx32/ld-linux-x32.so.2 /tools/lib/</userinput></screen>
     273<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
     274just a "brute force" workaraound - by copying the stubs-64.h file. -->
     275
     276  <caution>
     277    <para>At this point, it is imperative to stop and ensure that the basic
     278    functions (compiling and linking) of the new toolchain are working as
     279    expected. To perform a sanity check, run the following commands:</para>
     280
     281<screen><userinput>echo 'int main(){}' &gt; dummy.c
     282$LFS_TGT-gcc -m32 dummy.c
     283readelf -l a.out | grep ': /tools'</userinput></screen>
     284
     285    <para>If everything is working correctly, there should be no errors,
     286    and the output of the last command will be of the form:</para>
     287
     288<screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
     289
     290    <para>Redo test for x32-ABI:</para>
     291
     292<screen><userinput>echo 'int main(){}' &gt; dummy.c
     293$LFS_TGT-gcc -mx32 dummy.c
     294readelf -l a.out | grep ': /tools'</userinput></screen>
     295
     296    <para>Output should be like:</para>
     297
     298<screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux-x32.so.2]</computeroutput></screen>
     299
     300    <para>If the output is not shown as above or there was no output at all,
     301    then something is wrong. Investigate and retrace the steps to find out
     302    where the problem is and correct it. This issue must be resolved before
     303    continuing on.</para>
     304
     305    <para>Once all is well, clean up the test files:</para>
     306
     307<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     308
     309  </caution>
     310  </sect2>
     311 
    187312  <sect2 role="content">
    188313    <title/>
  • chapter05/ncurses.xml

    r989524c rb3f1ebb3  
    113113  </sect2>
    114114
     115  <sect2 arch="multilib" role="installation">
     116    <title>Installation of Ncurses - 32 bit</title>
     117
     118    <para>Prepare Ncurses for compilation:</para>
     119
     120<screen><userinput remap="configure">make distclean &amp;&amp;
     121CC="${LFS_TGT}-gcc -m32"          \
     122./configure --prefix=/tools       \
     123            --libdir=/tools/lib32 \
     124            --with-shared         \
     125            --without-debug       \
     126            --without-ada         \
     127            --enable-widec        \
     128            --enable-overwrite    \
     129            --host="${LFS_TGT32}"</userinput></screen>
     130
     131    <para>Compile the package:</para>
     132
     133<screen><userinput remap="make">make</userinput></screen>
     134
     135    <para>To test the results, issue:</para>
     136
     137<screen><userinput remap="test">make check</userinput></screen>
     138
     139    <para>Install the package:</para>
     140
     141<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
     142cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
     143
     144  </sect2>
     145
     146  <sect2 arch="multilib" role="installation">
     147    <title>Installation of Ncurses - x32 bit</title>
     148
     149    <para>Repeat for the x32-ABI:</para>
     150
     151<screen><userinput remap="configure">make distclean &amp;&amp;
     152CC="${LFS_TGT}-gcc -mx32"          \
     153./configure --prefix=/tools        \
     154            --libdir=/tools/libx32 \
     155            --with-shared          \
     156            --without-debug        \
     157            --without-ada          \
     158            --enable-widec         \
     159            --enable-overwrite     \
     160            --host="${LFS_TGTX32}"</userinput></screen>
     161
     162<screen><userinput remap="make">make</userinput></screen>
     163
     164<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
     165cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
     166
     167  </sect2>
     168
    115169  <sect2 role="content">
    116170    <title/>
  • chapter05/stripping.xml

    r989524c rb3f1ebb3  
    1616  debugging symbols. Remove those symbols with:</para>
    1717
    18 <screen><userinput>strip --strip-debug /tools/lib/*
     18<screen arch="default"><userinput>strip --strip-debug /tools/lib/*
     19/usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
     20
     21<screen arch="multilib"><userinput>strip --strip-debug /tools/lib{,{,x}32}/*
    1922/usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
    2023
     
    3437  <para>Remove unneeded files:</para>
    3538
    36 <screen><userinput>find /tools/{lib,libexec} -name \*.la -delete</userinput></screen>
     39<screen arch="default"><userinput>find /tools/{lib,libexec} -name \*.la -delete</userinput></screen>
     40
     41<screen arch="multilib"><userinput>find /tools/{lib{,{,x}32},libexec} -name \*.la -delete</userinput></screen>
    3742
    3843  <para>At this point, you should have at least 3 GB of free space in
  • chapter05/util-linux.xml

    r989524c rb3f1ebb3  
    122122  </sect2>
    123123
     124  <sect2 arch="multilib" role="installation">
     125    <title>Installation of Util-Linux - 32 bit</title>
     126
     127    <para>Prepare Util-Linux for compilation:</para>
     128
     129<screen><userinput remap="configure">make distclean &amp;&amp;
     130CC="${LFS_TGT}-gcc -m32"           \
     131./configure                        \
     132    --prefix=/tools                \
     133    --libdir=/tools/lib32          \
     134    --without-python               \
     135    --disable-makeinstall-chown    \
     136    --without-systemdsystemunitdir \
     137    --without-ncurses              \
     138    --host="${LFS_TGT32}"          \
     139    PKG_CONFIG=""</userinput></screen>
     140
     141    <para>Compile the package:</para>
     142
     143<screen><userinput remap="make">make</userinput></screen>
     144
     145    <para>To test the results, issue:</para>
     146
     147<screen><userinput remap="test">make check</userinput></screen>
     148
     149    <para>Install the package:</para>
     150
     151<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
     152cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
     153
     154  </sect2>
     155
     156  <sect2 arch="multilib" role="installation">
     157    <title>Installation of Util-Linux - x32 bit</title>
     158
     159    <para>Repeat for the x32-ABI:</para>
     160
     161<screen><userinput remap="configure">make distclean &amp;&amp;
     162CC="${LFS_TGT}-gcc -mx32"          \
     163./configure                        \
     164    --prefix=/tools                \
     165    --libdir=/tools/libx32         \
     166    --without-python               \
     167    --disable-makeinstall-chown    \
     168    --without-systemdsystemunitdir \
     169    --without-ncurses              \
     170    --host="${LFS_TGTX32}"         \
     171    PKG_CONFIG=""</userinput></screen>
     172
     173<screen><userinput remap="make">make</userinput></screen>
     174
     175<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
     176cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
     177
     178  </sect2>
     179
    124180</sect1>
  • chapter05/xz.xml

    r989524c rb3f1ebb3  
    6464  </sect2>
    6565
     66  <sect2 arch="multilib" role="installation">
     67    <title>Installation of Xz - 32 bit</title>
     68
     69    <para>Prepare Xz for compilation:</para>
     70
     71<screen><userinput remap="configure">make distclean &amp;&amp;
     72CC="${LFS_TGT}-gcc -m32"  \
     73./configure               \
     74    --prefix=/tools       \
     75    --libdir=/tools/lib32 \
     76    --host="${LFS_TGT32}"</userinput></screen>
     77
     78    <para>Compile the package:</para>
     79
     80<screen><userinput remap="make">make</userinput></screen>
     81
     82    <para>To test the results, issue:</para>
     83
     84<screen><userinput remap="test">make check</userinput></screen>
     85
     86    <para>Install the package:</para>
     87
     88<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
     89cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
     90
     91  </sect2>
     92
     93  <sect2 arch="multilib" role="installation">
     94    <title>Installation of Xz - x32 bit</title>
     95
     96    <para>Repeat for the x32-ABI:</para>
     97
     98<screen><userinput remap="configure">make distclean &amp;&amp;
     99CC="${LFS_TGT}-gcc -mx32"   \
     100./configure                 \
     101     --prefix=/tools        \
     102     --libdir=/tools/libx32 \
     103     --host="${LFS_TGTX32}"</userinput></screen>
     104
     105<screen><userinput remap="make">make</userinput></screen>
     106
     107<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
     108cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
     109
     110  </sect2>
     111
    66112  <sect2 role="content">
    67113    <title/>
Note: See TracChangeset for help on using the changeset viewer.