Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter08/glibc.xml

    r1b1acbed r0ebda11  
    6868    <para>Prepare Glibc for compilation:</para>
    6969
    70 <screen><userinput remap="configure">../configure --prefix=/usr                            \
     70<screen arch="default"><userinput remap="configure">../configure --prefix=/usr                            \
    7171             --disable-werror                         \
    7272             --enable-kernel=&min-kernel;                      \
    7373             --enable-stack-protector=strong          \
    7474             --with-headers=/usr/include              \
     75             libc_cv_slibdir=/usr/lib                 \
     76             libc_cv_rtlddir=/usr/lib</userinput></screen>
     77<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr                            \
     78             --disable-werror                         \
     79             --enable-kernel=&min-kernel;                      \
     80             --enable-stack-protector=strong          \
     81             --with-headers=/usr/include              \
     82             --enable-multi-arch                      \
    7583             libc_cv_slibdir=/usr/lib                 \
    7684             libc_cv_rtlddir=/usr/lib</userinput></screen>
     
    483491  </sect2>
    484492
     493  <!-- - - - - - - - - - -->
     494  <!-- Multilib - 32bit  -->
     495  <!-- - - - - - - - - - -->
     496  <sect2 arch="ml_32,ml_all">
     497    <title>Building Glibc - 32bit</title>
     498
     499    <para>Now recompile for m32. The extracted source can be
     500    reused but needs to be cleaned before installing the m32
     501    version of Glibc.</para>
     502
     503    <para>Clear the build directory and remove artefacts from
     504    previous build:</para>
     505     
     506<screen><userinput remap="pre">rm -rf ./*
     507find .. -name "*.a" -delete</userinput></screen>
     508
     509    <para>Configure Glibc for m32 with the following commands:</para>
     510
     511<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \
     512../configure                             \
     513      --prefix=/usr                      \
     514      --host=i686-pc-linux-gnu           \
     515      --build=$(../scripts/config.guess) \
     516      --enable-kernel=&min-kernel;                \
     517      --with-headers=/usr/include        \
     518      --enable-multi-arch                \
     519      --libdir=/usr/lib32                \
     520      --libexecdir=/usr/lib32            \
     521      libc_cv_slibdir=/usr/lib32         \
     522      libc_cv_rtlddir=/usr/lib32</userinput></screen>
     523
     524    <para>Compile the package:</para>
     525
     526<screen><userinput remap="make">make</userinput></screen>
     527
     528    <para>Install the package:</para>
     529
     530<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     531cp -a DESTDIR/usr/lib32/* /usr/lib32/
     532install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
     533               /usr/include/gnu/</userinput></screen>
     534<!-- no longer required as they are created in chap5
     535ln -svf ../lib32/ld-linux.so.2 /lib/ld-linux.so.2
     536-->
     537
     538    <para>Add the library name to the dynamic loader config:</para>
     539
     540<screen role="install"><userinput>echo "/usr/lib32" &gt;&gt; /etc/ld.so.conf</userinput></screen>
     541
     542    <caution>
     543      <para>At this point, it is imperative to stop and ensure that the basic
     544      functions (compiling and linking) of the new toolchain are working as
     545      expected. To perform a sanity check, run the following commands:</para>
     546
     547<screen><userinput>echo 'int main(){}' &gt; dummy.c
     548gcc -m32 dummy.c
     549readelf -l a.out | grep '/ld-linux'</userinput></screen>
     550
     551      <para>If everything is working correctly, there should be no errors,
     552      and the output of the last command will be of the form:</para>
     553
     554<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
     555
     556      <para>If the output is not shown as above or there was no output at all,
     557      then something is wrong. Investigate and retrace the steps to find out
     558      where the problem is and correct it. This issue must be resolved before
     559      continuing on.</para>
     560
     561      <para>Once all is well, clean up the test files:</para>
     562
     563<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     564
     565    </caution>
     566
     567  </sect2><!-- m32 -->
     568
     569  <!-- - - - - - - - - - -->
     570  <!-- Multilib - x32bit -->
     571  <!-- - - - - - - - - - -->
     572 
     573  <sect2 arch="ml_x32,ml_all">
     574    <title>Building Glibc - x32bit</title>
     575
     576    <para>Now recompile for mx32. The extracted source can be
     577    reused but needs to be cleaned before installing the mx32
     578    version of Glibc.</para>
     579
     580    <para>Clear the build directory and remove artefacts from
     581    previous build:</para>
     582     
     583<screen><userinput remap="pre">rm -rf ./*
     584find .. -name "*.a" -delete</userinput></screen>
     585
     586    <para>Configure Glibc for mx32 with the following commands:</para>
     587
     588<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \
     589../configure                             \
     590      --prefix=/usr                      \
     591      --host=x86_64-pc-linux-gnux32      \
     592      --build=$(../scripts/config.guess) \
     593      --enable-kernel=&min-kernel;                \
     594      --with-headers=/usr/include        \
     595      --enable-multi-arch                \
     596      --libdir=/usr/libx32               \
     597      --libexecdir=/usr/libx32           \
     598      libc_cv_slibdir=/usr/libx32         \
     599      libc_cv_rtlddir=/usr/libx32</userinput></screen>
     600
     601    <para>Compile the package:</para>
     602
     603<screen><userinput remap="make">make</userinput></screen>
     604
     605    <para>Install the package:</para>
     606
     607<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     608cp -a DESTDIR/usr/libx32/* /usr/libx32/
     609install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
     610               /usr/include/gnu/</userinput></screen>
     611<!-- no longer required as they are created in chap5
     612ln -svf ../libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2
     613-->
     614    <para>Add the library name to the dynamic loader config:</para>
     615
     616<screen role="install"><userinput>echo "/usr/libx32" &gt;&gt; /etc/ld.so.conf</userinput></screen>
     617
     618    <caution>
     619      <para>At this point, it is imperative to stop and ensure that the basic
     620      functions (compiling and linking) of the new toolchain are working as
     621      expected. To perform a sanity check, run the following commands:</para>
     622
     623<screen><userinput>echo 'int main(){}' &gt; dummy.c
     624gcc -mx32 dummy.c
     625readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
     626
     627      <para>If everything is working correctly, there should be no errors,
     628      and the output of the last command will be of the form:</para>
     629
     630<screen><computeroutput>[Requesting program interpreter: /libx32/ld-linux-x32.so.2]</computeroutput></screen>
     631
     632      <para>If the output is not shown as above or there was no output at all,
     633      then something is wrong. Investigate and retrace the steps to find out
     634      where the problem is and correct it. This issue must be resolved before
     635      continuing on.</para>
     636
     637      <para>Once all is well, clean up the test files:</para>
     638
     639<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     640
     641    </caution>
     642
     643  </sect2><!-- mx32 -->
     644
    485645  <sect2 id="contents-glibc" role="content">
    486646    <title>Contents of Glibc</title>
Note: See TracChangeset for help on using the changeset viewer.