Ignore:
Timestamp:
03/31/2021 10:41:39 AM (3 years ago)
Author:
Xℹ Ruoyao <xry111@…>
Branches:
ml-11.0, multilib
Children:
7610848
Parents:
811b5a39
git-author:
Thomas Trepl <thomas@…> (06/29/2020 07:55:01 AM)
git-committer:
Xℹ Ruoyao <xry111@…> (03/31/2021 10:41:39 AM)
Message:

Update to new lfs structure

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

File:
1 moved

Legend:

Unmodified
Added
Removed
  • chapter08/glibc.xml

    r811b5a39 r6dfcfecc  
    3434
    3535      <seglistitem>
    36         <seg>&glibc-ch6-sbu;</seg>
    37         <seg>&glibc-ch6-du;</seg>
     36        <seg>&glibc-fin-sbu;</seg>
     37        <seg>&glibc-fin-du;</seg>
    3838      </seglistitem>
    3939    </segmentedlist>
     
    4343  <sect2 role="installation">
    4444    <title>Installation of Glibc</title>
    45 
    46     <note><para>The Glibc build system is self-contained and will install
    47     perfectly, even though the compiler specs file and linker are still
    48     pointing to <filename class="directory">/tools</filename>. The specs
    49     and linker cannot be adjusted before the Glibc install because the
    50     Glibc autoconf tests would give false results and defeat the goal
    51     of achieving a clean build.</para></note>
    5245
    5346    <para>Some of the Glibc programs use the non-FHS compliant
     
    5750
    5851<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
    59 <!--
    60     <para>Fix a minor security issue with glob functions:</para>
    61 
    62 <screen><userinput remap="pre">patch -Np1 -i ../&glibc-glob-patch;</userinput></screen>
    63 -->
    64 <!-- No longer needed
    65     <para>Fix a problem introduced with the linux-5.2 kernel:</para>
    66 
    67 <screen><userinput remap="pre">sed -i '/asm.socket.h/a# include &lt;linux/sockios.h&gt;' \
    68    sysdeps/unix/sysv/linux/bits/socket.h</userinput></screen>
    69 -->
    70     <para>Create a symlink for LSB
    71     compliance. Additionally, for x86_64, create a compatibility symlink
    72     required for the dynamic loader to function correctly:</para>
    73 
    74 <screen><userinput remap="pre">case $(uname -m) in
    75     i?86)   ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3
    76     ;;
    77     x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64
    78             ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
    79     ;;
    80 esac</userinput></screen>
    81 <!--
    82     <para>Remove a file that may be left over from a previous build attempt:
    83     </para>
    84 
    85 <screen><userinput remap="pre">rm -f /usr/include/limits.h</userinput></screen>
    86 -->
     52
    8753    <para>The Glibc documentation recommends building Glibc
    8854    in a dedicated build directory:</para>
     
    9359    <para>Prepare Glibc for compilation:</para>
    9460
    95 <screen><userinput remap="configure">CC="gcc -ffile-prefix-map=/tools=/usr" \
    96 ../configure --prefix=/usr                          \
    97              --disable-werror                       \
    98              --enable-kernel=&min-kernel;                    \
    99              --enable-stack-protector=strong        \
    100              --with-headers=/usr/include            \
     61<screen arch="default"><userinput remap="configure">../configure --prefix=/usr                            \
     62             --disable-werror                         \
     63             --enable-kernel=&min-kernel;                      \
     64             --enable-stack-protector=strong          \
     65             --with-headers=/usr/include              \
    10166             libc_cv_slibdir=/lib</userinput></screen>
    102 
    103    <variablelist>
    104       <title>The meaning of the options and new configure parameters:</title>
    105 
    106       <varlistentry>
    107         <term><parameter>CC="gcc -ffile-prefix-map=/tools=/usr"</parameter></term>
    108         <listitem>
    109           <para>Make GCC record any references to files in /tools in result
    110           of the compilation as if the files resided in /usr.  This avoids
    111           introduction of invalid paths in debugging symbols.</para>
    112         </listitem>
    113       </varlistentry>
     67<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr                            \
     68             --disable-werror                         \
     69             --enable-kernel=&min-kernel;                      \
     70             --enable-stack-protector=strong          \
     71             --with-headers=/usr/include              \
     72             --enable-multi-arch                      \
     73             libc_cv_slibdir=/lib</userinput></screen>
     74
     75    <variablelist>
     76      <title>The meaning of the configure options:</title>
    11477
    11578      <varlistentry>
     
    11881          <para>This option disables the -Werror option passed to
    11982          GCC.  This is necessary for running the test suite.</para>
     83        </listitem>
     84      </varlistentry>
     85
     86      <varlistentry>
     87        <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
     88        <listitem>
     89          <para>This option tells the build system that this glibc may
     90          be used with kernels as old as &min-kernel;. This means generating
     91          workarounds in case a system call introduced in a later version
     92          cannot be used.</para>
    12093        </listitem>
    12194      </varlistentry>
     
    129102        </listitem>
    130103      </varlistentry>
    131 
     104<!-- do we need this one? -->
    132105      <varlistentry>
    133106        <term><parameter>--with-headers=/usr/include</parameter></term>
    134107        <listitem>
    135108          <para>This option tells the build system where to find the
    136           kernel API headers. By default, those headers are sought in
    137           <filename class="directory">/tools/include</filename>.</para>
     109          kernel API headers.</para>
    138110        </listitem>
    139111      </varlistentry>
     
    183155        is known to fail in the LFS chroot environment.</para>
    184156      </listitem>
    185 
     157<!--
    186158      <listitem>
    187159        <para><emphasis>inet/tst-idna_name_classify</emphasis>
     
    194166        may fail on some architectures.</para>
    195167      </listitem>
    196 
     168-->
    197169      <listitem>
    198170        <para>The <emphasis>nss/tst-nss-files-hosts-multi</emphasis>
     
    213185        AMD processor.</para>
    214186      </listitem>
    215 <!--
    216       <listitem>
    217         <para>The
    218         <emphasis>nptl/tst-thread-affinity-{pthread,pthread2,sched}</emphasis>
    219         tests may fail for reasons that have not been determined.  </para>
    220       </listitem>
    221 
    222       <listitem>
    223         <para>Other tests known to fail on some architectures are
    224         malloc/tst-malloc-usable and nptl/tst-cleanupx4. </para>
    225       </listitem>
    226 -->
     187
    227188    </itemizedlist>
    228189
     
    389350        <term><parameter>zic -L /dev/null ...</parameter></term>
    390351        <listitem>
    391           <para>This creates posix time zones, without any leap seconds.  It is
     352          <para>This creates posix time zones without any leap seconds.  It is
    392353          conventional to put these in both
    393354          <filename class="directory">zoneinfo</filename> and
     
    397358          test-suites will report errors. On an embedded system, where space is
    398359          tight and you do not intend to ever update the time zones, you could save
    399           1.9MB by not using the <filename class="directory">posix</filename>
     360          1.9 MB by not using the <filename class="directory">posix</filename>
    400361          directory, but some applications or test-suites might produce some
    401362          failures.</para>
     
    477438EOF</userinput></screen>
    478439
    479   <para arch="default">If desired, the dynamic loader can also search a directory and
     440  <para>If desired, the dynamic loader can also search a directory and
    480441  include the contents of files found there.  Generally the files in
    481442  this include directory are one line specifying the desired library path.
    482443  To add this capability run the following commands:</para>
    483444
    484 <screen role="nodump" arch="default"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; "EOF"
     445<screen role="nodump"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; "EOF"
    485446<literal># Add an include directory
    486447include /etc/ld.so.conf.d/*.conf
     
    489450mkdir -pv /etc/ld.so.conf.d</userinput></screen>
    490451
    491   <para arch="ml_32,ml_x32,ml_all">The dynamic loader can also search a directory and
    492   include the contents of files found there.  Generally the files in
    493   this include directory are one line specifying the desired library path.
    494   To add this capability run the following commands:</para>
    495 <screen arch="ml_32,ml_x32,ml_all"><userinput>cat &gt;&gt; /etc/ld.so.conf &lt;&lt; "EOF"
    496 <literal># Add an include directory
    497 include /etc/ld.so.conf.d/*.conf
    498 </literal>
    499 EOF
    500 mkdir -pv /etc/ld.so.conf.d</userinput></screen>
    501 
    502452  </sect3>
    503453  </sect2>
     454
     455  <!-- - - - - - - - - - -->
     456  <!-- Multilib - 32bit  -->
     457  <!-- - - - - - - - - - -->
     458  <sect2 arch="ml_32,ml_all">
     459    <title>Building Glibc - 32bit</title>
     460
     461    <para>Now recompile for m32. The extracted source can be
     462    reused but needs to cleaned before installing the m32
     463    version of Glibc.</para>
     464
     465    <para>Clear the build directory and remove artefacts from
     466    previous build:</para>
     467     
     468<screen><userinput remap="pre">rm -rf ./*
     469find .. -name "*.a" -delete</userinput></screen>
     470
     471    <para>Configure Glibc for m32 with the following commands:</para>
     472
     473<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \
     474../configure                             \
     475      --prefix=/usr                      \
     476      --host=i686-pc-linux-gnu           \
     477      --build=$(../scripts/config.guess) \
     478      --enable-kernel=&min-kernel;                \
     479      --with-headers=/usr/include        \
     480      --enable-multi-arch                \
     481      --libdir=&usr-lib-m32;                \
     482      --libexecdir=&usr-lib-m32;            \
     483      libc_cv_slibdir=&lib-m32;</userinput></screen>
     484
     485    <para>Compile the package:</para>
     486
     487<screen><userinput remap="make">make</userinput></screen>
     488
     489    <para>Install the package:</para>
     490
     491<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     492cp -a DESTDIR&lib-m32;/*     &lib-m32;/
     493cp -a DESTDIR&usr-lib-m32;/* &usr-lib-m32;/
     494install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
     495               /usr/include/gnu/
     496ln -svf ..&lib-m32;/ld-linux.so.2 /lib/ld-linux.so.2</userinput></screen>
     497
     498    <para>Add the library name to the dynamic loader config:</para>
     499
     500<screen role="install"><userinput>echo "&usr-lib-m32;" &gt;&gt; /etc/ld.so.conf</userinput></screen>
     501
     502    <caution>
     503      <para>At this point, it is imperative to stop and ensure that the basic
     504      functions (compiling and linking) of the new toolchain are working as
     505      expected. To perform a sanity check, run the following commands:</para>
     506
     507<screen><userinput>echo 'int main(){}' &gt; dummy.c
     508gcc -m32 dummy.c
     509readelf -l a.out | grep '/ld-linux'</userinput></screen>
     510
     511      <para>If everything is working correctly, there should be no errors,
     512      and the output of the last command will be of the form:</para>
     513
     514<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
     515
     516      <para>If the output is not shown as above or there was no output at all,
     517      then something is wrong. Investigate and retrace the steps to find out
     518      where the problem is and correct it. This issue must be resolved before
     519      continuing on.</para>
     520
     521      <para>Once all is well, clean up the test files:</para>
     522
     523<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     524
     525    </caution>
     526
     527  </sect2><!-- m32 -->
     528
     529  <!-- - - - - - - - - - -->
     530  <!-- Multilib - x32bit -->
     531  <!-- - - - - - - - - - -->
     532 
     533  <sect2 arch="ml_x32,ml_all">
     534    <title>Building Glibc - x32bit</title>
     535
     536    <para>Now recompile for mx32. The extracted source can be
     537    reused but needs to cleaned before installing the mx32
     538    version of Glibc.</para>
     539
     540    <para>Clear the build directory and remove artefacts from
     541    previous build:</para>
     542     
     543<screen><userinput remap="pre">rm -rf ./*
     544find .. -name "*.a" -delete</userinput></screen>
     545
     546    <para>Configure Glibc for mx32 with the following commands:</para>
     547
     548<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \
     549../configure                             \
     550      --prefix=/usr                      \
     551      --host=x86_64-pc-linux-gnux32      \
     552      --build=$(../scripts/config.guess) \
     553      --enable-kernel=&min-kernel;                \
     554      --with-headers=$LFS/usr/include    \
     555      --enable-multi-arch                \
     556      --libdir=&usr-lib-mx32;               \
     557      --libexecdir=&usr-lib-mx32;           \
     558      libc_cv_slibdir=&lib-mx32;</userinput></screen>
     559
     560    <para>Compile the package:</para>
     561
     562<screen><userinput remap="make">make</userinput></screen>
     563
     564    <para>Install the package:</para>
     565
     566<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
     567cp -a DESTDIR&lib-mx32;/*     &lib-mx32;/
     568cp -a DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;/
     569install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
     570               /usr/include/gnu/
     571ln -svf ..&lib-mx32;/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2</userinput></screen>
     572
     573    <para>Add the library name to the dynamic loader config:</para>
     574
     575<screen role="install"><userinput>echo "&usr-lib-mx32;" &gt;&gt; /etc/ld.so.conf</userinput></screen>
     576
     577    <caution>
     578      <para>At this point, it is imperative to stop and ensure that the basic
     579      functions (compiling and linking) of the new toolchain are working as
     580      expected. To perform a sanity check, run the following commands:</para>
     581
     582<screen><userinput>echo 'int main(){}' &gt; dummy.c
     583gcc -mx32 dummy.c
     584readelf -l a.out | grep '/ld-linux-x32'</userinput></screen>
     585
     586      <para>If everything is working correctly, there should be no errors,
     587      and the output of the last command will be of the form:</para>
     588
     589<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux-x32.so.2]</computeroutput></screen>
     590
     591      <para>If the output is not shown as above or there was no output at all,
     592      then something is wrong. Investigate and retrace the steps to find out
     593      where the problem is and correct it. This issue must be resolved before
     594      continuing on.</para>
     595
     596      <para>Once all is well, clean up the test files:</para>
     597
     598<screen><userinput>rm -v dummy.c a.out</userinput></screen>
     599
     600    </caution>
     601
     602  </sect2><!-- mx32 -->
    504603
    505604  <sect2 id="contents-glibc" role="content">
Note: See TracChangeset for help on using the changeset viewer.