Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter05/glibc.xml

    ra6307b6c rceebda5  
    4848    operation of the dynamic library loader:</para>
    4949
    50 <screen><userinput remap="pre">case $(uname -m) in
     50<screen arch="default"><userinput remap="pre">case $(uname -m) in
    5151    i?86)   ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
    5252    ;;
     
    5555    ;;
    5656esac</userinput></screen>
     57<!-- no ld-linux.so.2 here as multilib is based on x86_64, not on i686 -->
     58<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
     59ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
    5760
    5861    <note>
     
    8083    <para>Next, prepare Glibc for compilation:</para>
    8184
    82 <screen><userinput remap="configure">../configure                             \
     85<screen arch="default"><userinput remap="configure">../configure                             \
    8386      --prefix=/usr                      \
    8487      --host=$LFS_TGT                    \
     
    8689      --enable-kernel=&min-kernel;                \
    8790      --with-headers=$LFS/usr/include    \
     91      libc_cv_slibdir=/lib</userinput></screen>
     92<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure                             \
     93      --prefix=/usr                      \
     94      --host=$LFS_TGT                    \
     95      --build=$(../scripts/config.guess) \
     96      --enable-kernel=&min-kernel;                \
     97      --with-headers=$LFS/usr/include    \
     98      --enable-multi-arch                \
     99      --libdir=/usr/lib                  \
     100      --libexecdir=/usr/lib              \
    88101      libc_cv_slibdir=/lib</userinput></screen>
    89102<!--
     
    208221<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
    209222
    210       <para>Note that for 32-bit machines, the interpreter name will be
     223      <para arch="default">Note that for 32-bit machines, the interpreter name will be
    211224      <filename>/lib/ld-linux.so.2</filename>.</para>
    212225
     
    236249  </sect2>
    237250
     251  <!-- - - - - - - - - - -->
     252  <!-- Multilib - 32bit  -->
     253  <!-- - - - - - - - - - -->
     254  <sect2 arch="ml_32,ml_all">
     255    <title>Building Glibc - 32bit</title>
     256
     257    <para>Now recompile for m32. The extracted source can be
     258    reused but needs to cleaned before installing the m32
     259    version of Glibc.</para>
     260
     261    <para>Clear the build directory and remove artefacts from
     262    previous build:</para>
     263     
     264<screen><userinput remap="pre">make clean
     265find .. -name "*.a" -delete</userinput></screen>
     266
     267    <para>Configure Glibc for m32 with the following commands:</para>
     268
     269<screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \
     270CXX="$LFS_TGT-g++ -m32" \
     271../configure                             \
     272      --prefix=/usr                      \
     273      --host=$LFS_TGT32                  \
     274      --build=$(../scripts/config.guess) \
     275      --enable-kernel=&min-kernel;                \
     276      --with-headers=$LFS/usr/include    \
     277      --enable-multi-arch                \
     278      --libdir=&usr-lib-m32;                \
     279      --libexecdir=&usr-lib-m32;            \
     280      libc_cv_slibdir=&lib-m32;</userinput></screen>
     281
     282    <para>Compile the package:</para>
     283
     284<screen><userinput remap="make">make</userinput></screen>
     285
     286    <para>Install the package:</para>
     287
     288<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     289cp -a DESTDIR&lib-m32;/*     $LFS&lib-m32;/
     290cp -a DESTDIR&usr-lib-m32; $LFS/usr/
     291install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
     292               $LFS/usr/include/gnu/
     293ln -svf ..&lib-m32;/ld-linux.so.2 $LFS/lib/ld-linux.so.2</userinput></screen>
     294
     295    <caution>
     296      <para>At this point, it is imperative to stop and ensure that the basic
     297      functions (compiling and linking) of the new toolchain are working as
     298      expected. To perform a sanity check, run the following commands:</para>
     299
     300<screen><userinput>echo 'int main(){}' &gt; dummy.c
     301$LFS_TGT-gcc -m32 dummy.c
     302readelf -l a.out | grep '/ld-linux'</userinput></screen>
     303
     304      <para>If everything is working correctly, there should be no errors,
     305      and the output of the last command will be of the form:</para>
     306
     307<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
     308
     309      <para>If the output is not shown as above or there was no output at all,
     310      then something is wrong. Investigate and retrace the steps to find out
     311      where the problem is and correct it. This issue must be resolved before
     312      continuing on.</para>
     313
     314      <para>Once all is well, clean up the test files:</para>
     315
     316<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     317
     318    </caution>
     319
     320  </sect2><!-- m32 -->
     321
     322  <!-- - - - - - - - - - -->
     323  <!-- Multilib - x32bit -->
     324  <!-- - - - - - - - - - -->
     325 
     326  <sect2 arch="ml_x32,ml_all">
     327    <title>Building Glibc - x32bit</title>
     328
     329    <para>Now recompile for mx32. The extracted source can be
     330    reused but needs to cleaned before installing the mx32
     331    version of Glibc.</para>
     332
     333    <para>Clear the build directory and remove artefacts from
     334    previous build:</para>
     335     
     336<screen><userinput remap="pre">make clean
     337find .. -name "*.a" -delete</userinput></screen>
     338
     339    <para>Configure Glibc for mx32 with the following commands:</para>
     340
     341<screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \
     342CXX="$LFS_TGT-g++ -mx32" \
     343../configure                             \
     344      --prefix=/usr                      \
     345      --host=$LFS_TGTX32                 \
     346      --build=$(../scripts/config.guess) \
     347      --enable-kernel=&min-kernel;                \
     348      --with-headers=$LFS/usr/include    \
     349      --enable-multi-arch                \
     350      --libdir=&usr-lib-mx32;               \
     351      --libexecdir=&usr-lib-mx32;           \
     352      libc_cv_slibdir=&lib-mx32;</userinput></screen>
     353
     354    <para>Compile the package:</para>
     355
     356<screen><userinput remap="make">make</userinput></screen>
     357
     358    <para>Install the package:</para>
     359
     360<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     361cp -a DESTDIR&lib-mx32;/*     $LFS&lib-mx32;/
     362cp -a DESTDIR&usr-lib-mx32; $LFS/usr/
     363install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
     364               $LFS/usr/include/gnu/
     365ln -svf ..&lib-mx32;/ld-linux-x32.so.2 $LFS/lib/ld-linux-x32.so.2</userinput></screen>
     366
     367    <caution>
     368      <para>At this point, it is imperative to stop and ensure that the basic
     369      functions (compiling and linking) of the new toolchain are working as
     370      expected. To perform a sanity check, run the following commands:</para>
     371
     372<screen><userinput>echo 'int main(){}' &gt; dummy.c
     373$LFS_TGT-gcc -mx32 dummy.c
     374readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
     375
     376      <para>If everything is working correctly, there should be no errors,
     377      and the output of the last command will be of the form:</para>
     378
     379<screen><computeroutput>[Requesting program interpreter: /libx32/ld-linux-x32.so.2]</computeroutput></screen>
     380
     381      <para>If the output is not shown as above or there was no output at all,
     382      then something is wrong. Investigate and retrace the steps to find out
     383      where the problem is and correct it. This issue must be resolved before
     384      continuing on.</para>
     385
     386      <para>Once all is well, clean up the test files:</para>
     387
     388<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     389
     390    </caution>
     391
     392  </sect2><!-- mx32 -->
     393
    238394  <sect2 role="content">
    239395    <title/>
Note: See TracChangeset for help on using the changeset viewer.