Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter08/glibc.xml

    rd15bbff r4c8c128  
    6464    <para>Prepare Glibc for compilation:</para>
    6565
    66 <screen><userinput remap="configure">../configure --prefix=/usr                            \
     66<screen arch="default"><userinput remap="configure">../configure --prefix=/usr                            \
    6767             --disable-werror                         \
    6868             --enable-kernel=&min-kernel;                      \
    6969             --enable-stack-protector=strong          \
    7070             --with-headers=/usr/include              \
     71             libc_cv_slibdir=/lib</userinput></screen>
     72<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr                            \
     73             --disable-werror                         \
     74             --enable-kernel=&min-kernel;                      \
     75             --enable-stack-protector=strong          \
     76             --with-headers=/usr/include              \
     77             --enable-multi-arch                      \
    7178             libc_cv_slibdir=/lib</userinput></screen>
    7279
     
    461468  </sect2>
    462469
     470  <!-- - - - - - - - - - -->
     471  <!-- Multilib - 32bit  -->
     472  <!-- - - - - - - - - - -->
     473  <sect2 arch="ml_32,ml_all">
     474    <title>Building Glibc - 32bit</title>
     475
     476    <para>Now recompile for m32. The extracted source can be
     477    reused but needs to cleaned before installing the m32
     478    version of Glibc.</para>
     479
     480    <para>Clear the build directory and remove artefacts from
     481    previous build:</para>
     482     
     483<screen><userinput remap="pre">rm -rf ./*
     484find .. -name "*.a" -delete</userinput></screen>
     485
     486    <para>Configure Glibc for m32 with the following commands:</para>
     487
     488<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \
     489../configure                             \
     490      --prefix=/usr                      \
     491      --host=i686-pc-linux-gnu           \
     492      --build=$(../scripts/config.guess) \
     493      --enable-kernel=&min-kernel;                \
     494      --with-headers=/usr/include        \
     495      --enable-multi-arch                \
     496      --libdir=&usr-lib-m32;                \
     497      --libexecdir=&usr-lib-m32;            \
     498      libc_cv_slibdir=&lib-m32;</userinput></screen>
     499
     500    <para>Compile the package:</para>
     501
     502<screen><userinput remap="make">make</userinput></screen>
     503
     504    <para>Install the package:</para>
     505
     506<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     507cp -a DESTDIR&lib-m32;/*     &lib-m32;/
     508cp -a DESTDIR&usr-lib-m32;/* &usr-lib-m32;/
     509install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
     510               /usr/include/gnu/
     511ln -svf ..&lib-m32;/ld-linux.so.2 /lib/ld-linux.so.2</userinput></screen>
     512
     513    <para>Add the library name to the dynamic loader config:</para>
     514
     515<screen role="install"><userinput>echo "&usr-lib-m32;" &gt;&gt; /etc/ld.so.conf</userinput></screen>
     516
     517    <caution>
     518      <para>At this point, it is imperative to stop and ensure that the basic
     519      functions (compiling and linking) of the new toolchain are working as
     520      expected. To perform a sanity check, run the following commands:</para>
     521
     522<screen><userinput>echo 'int main(){}' &gt; dummy.c
     523gcc -m32 dummy.c
     524readelf -l a.out | grep '/ld-linux'</userinput></screen>
     525
     526      <para>If everything is working correctly, there should be no errors,
     527      and the output of the last command will be of the form:</para>
     528
     529<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
     530
     531      <para>If the output is not shown as above or there was no output at all,
     532      then something is wrong. Investigate and retrace the steps to find out
     533      where the problem is and correct it. This issue must be resolved before
     534      continuing on.</para>
     535
     536      <para>Once all is well, clean up the test files:</para>
     537
     538<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     539
     540    </caution>
     541
     542  </sect2><!-- m32 -->
     543
     544  <!-- - - - - - - - - - -->
     545  <!-- Multilib - x32bit -->
     546  <!-- - - - - - - - - - -->
     547 
     548  <sect2 arch="ml_x32,ml_all">
     549    <title>Building Glibc - x32bit</title>
     550
     551    <para>Now recompile for mx32. The extracted source can be
     552    reused but needs to cleaned before installing the mx32
     553    version of Glibc.</para>
     554
     555    <para>Clear the build directory and remove artefacts from
     556    previous build:</para>
     557     
     558<screen><userinput remap="pre">rm -rf ./*
     559find .. -name "*.a" -delete</userinput></screen>
     560
     561    <para>Configure Glibc for mx32 with the following commands:</para>
     562
     563<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \
     564../configure                             \
     565      --prefix=/usr                      \
     566      --host=x86_64-pc-linux-gnux32      \
     567      --build=$(../scripts/config.guess) \
     568      --enable-kernel=&min-kernel;                \
     569      --with-headers=$LFS/usr/include    \
     570      --enable-multi-arch                \
     571      --libdir=&usr-lib-mx32;               \
     572      --libexecdir=&usr-lib-mx32;           \
     573      libc_cv_slibdir=&lib-mx32;</userinput></screen>
     574
     575    <para>Compile the package:</para>
     576
     577<screen><userinput remap="make">make</userinput></screen>
     578
     579    <para>Install the package:</para>
     580
     581<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     582cp -a DESTDIR&lib-mx32;/*     &lib-mx32;/
     583cp -a DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;/
     584install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
     585               /usr/include/gnu/
     586ln -svf ..&lib-mx32;/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2</userinput></screen>
     587
     588    <para>Add the library name to the dynamic loader config:</para>
     589
     590<screen role="install"><userinput>echo "&usr-lib-mx32;" &gt;&gt; /etc/ld.so.conf</userinput></screen>
     591
     592    <caution>
     593      <para>At this point, it is imperative to stop and ensure that the basic
     594      functions (compiling and linking) of the new toolchain are working as
     595      expected. To perform a sanity check, run the following commands:</para>
     596
     597<screen><userinput>echo 'int main(){}' &gt; dummy.c
     598gcc -mx32 dummy.c
     599readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
     600
     601      <para>If everything is working correctly, there should be no errors,
     602      and the output of the last command will be of the form:</para>
     603
     604<screen><computeroutput>[Requesting program interpreter: /libx32/ld-linux-x32.so.2]</computeroutput></screen>
     605
     606      <para>If the output is not shown as above or there was no output at all,
     607      then something is wrong. Investigate and retrace the steps to find out
     608      where the problem is and correct it. This issue must be resolved before
     609      continuing on.</para>
     610
     611      <para>Once all is well, clean up the test files:</para>
     612
     613<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     614
     615    </caution>
     616
     617  </sect2><!-- mx32 -->
     618
    463619  <sect2 id="contents-glibc" role="content">
    464620    <title>Contents of Glibc</title>
Note: See TracChangeset for help on using the changeset viewer.