Ignore:
Timestamp:
05/03/2020 09:02:51 PM (4 years ago)
Author:
Pierre Labastie <pieere@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
a715dec
Parents:
9d719e2
Message:

Make the new book

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter05/glibc.xml

    r9d719e2 refcb393  
    4444    <title>Installation of Glibc</title>
    4545
     46    <para>First, create two symbolic links, which are needed for proper
     47    operation of the dynamic library loader:</para>
     48
     49<screen><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
     50ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
     51
     52    <para>Some of the Glibc programs use the non-FHS compliant
     53    <filename class="directory">/var/db</filename> directory to store their
     54    runtime data. Apply the following patch to make such programs store their
     55    runtime data in the FHS-compliant locations:</para>
     56
     57<screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen>
     58
    4659    <para>The Glibc documentation recommends building Glibc
    4760    in a dedicated build directory:</para>
     
    5366
    5467<screen><userinput remap="configure">../configure                             \
    55       --prefix=/tools                    \
     68      --prefix=/usr                      \
    5669      --host=$LFS_TGT                    \
    5770      --build=$(../scripts/config.guess) \
    5871      --enable-kernel=&min-kernel;                \
    59       --with-headers=/tools/include</userinput></screen>
     72      --with-headers=$LFS/usr/include    \
     73      libc_cv_slibdir=/lib</userinput></screen>
    6074<!--
    6175      libc_cv_forced_unwind=yes          \
     
    6983        <listitem>
    7084          <para>The combined effect of these switches is that Glibc's build system
    71           configures itself to cross-compile, using the cross-linker and
     85          configures itself to be cross-compiled, using the cross-linker and
    7286          cross-compiler in <filename class="directory">/tools</filename>.</para>
    7387        </listitem>
     
    8498
    8599      <varlistentry>
    86         <term><parameter>--with-headers=/tools/include</parameter></term>
     100        <term><parameter>--with-headers=$LFS/usr/include</parameter></term>
    87101        <listitem>
    88102          <para>This tells Glibc to compile itself against the headers recently
    89           installed to the tools directory, so that it knows exactly what
     103          installed to the usr/include directory, so that it knows exactly what
    90104          features the kernel has and can optimize itself accordingly.</para>
    91105        </listitem>
    92106      </varlistentry>
     107
     108      <varlistentry>
     109        <term><parameter>libc_cv_slibdir=/lib</parameter></term>
     110        <listitem>
     111          <para>This ensures that the library is installed in /lib instead
     112          of the default /lib64 on 64 bit machines.</para>
     113        </listitem>
     114      </varlistentry>
    93115<!--
    94       <varlistentry>
    95         <term><parameter>libc_cv_forced_unwind=yes</parameter></term>
    96         <listitem>
    97           <para>The linker installed during
    98           <xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as
    99           such cannot be used until Glibc has been installed.  This means that
    100           the configure test for force-unwind support will fail, as it relies on
    101           a working linker.  The libc_cv_forced_unwind=yes variable is passed in
    102           order to inform <command>configure</command> that force-unwind
    103           support is available without it having to run the test.</para>
    104         </listitem>
    105       </varlistentry>
    106116      <varlistentry>
    107117        <term><parameter>libc_cv_c_cleanup=yes</parameter></term>
     
    112122        </listitem>
    113123      </varlistentry>
    114 -->
    115 <!--  <varlistentry>
     124
     125      <varlistentry>
    116126        <term><parameter>libc_cv_ctors_header=yes</parameter></term>
    117127        <listitem>
     
    148158    <para>Install the package:</para>
    149159
    150 <screen><userinput remap="install">make install</userinput></screen>
    151 
    152   <caution>
    153     <para>At this point, it is imperative to stop and ensure that the basic
    154     functions (compiling and linking) of the new toolchain are working as
    155     expected. To perform a sanity check, run the following commands:</para>
     160<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
     161
     162    <variablelist>
     163      <title>The meaning of the <command>make install</command> option:</title>
     164
     165      <varlistentry>
     166        <term><parameter>DESTDIR=$LFS</parameter></term>
     167        <listitem>
     168          <para>The <envar>DESTDIR</envar> make variable is used by almost all
     169          packages to define the location where the package should be
     170          installed. If it is not set, it defaults to the root (<filename
     171          class="directory">/</filename>) directory. Here we specify that
     172          the package be installed in <filename class="directory">$LFS
     173          </filename>, which will become the root after <xref linkend=
     174          "ch-tools-chroot"/>.</para>
     175        </listitem>
     176      </varlistentry>
     177
     178    </variablelist>
     179
     180    <caution>
     181      <para>At this point, it is imperative to stop and ensure that the basic
     182      functions (compiling and linking) of the new toolchain are working as
     183      expected. To perform a sanity check, run the following commands:</para>
    156184
    157185<screen><userinput>echo 'int main(){}' &gt; dummy.c
    158186$LFS_TGT-gcc dummy.c
    159 readelf -l a.out | grep ': /tools'</userinput></screen>
    160 
    161     <para>If everything is working correctly, there should be no errors,
    162     and the output of the last command will be of the form:</para>
    163 
    164 <screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
    165 
    166     <para>Note that for 32-bit machines, the interpreter name will be
    167     <filename>/tools/lib/ld-linux.so.2</filename>.</para>
    168 
    169     <para>If the output is not shown as above or there was no output at all,
    170     then something is wrong. Investigate and retrace the steps to find out
    171     where the problem is and correct it. This issue must be resolved before
    172     continuing on.</para>
    173 
    174     <para>Once all is well, clean up the test files:</para>
     187readelf -l a.out | grep '/ld-linux'</userinput></screen>
     188
     189      <para>If everything is working correctly, there should be no errors,
     190      and the output of the last command will be of the form:</para>
     191
     192<screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
     193
     194      <para>Note that for 32-bit machines, the interpreter name will be
     195      <filename>/lib/ld-linux.so.2</filename>.</para>
     196
     197      <para>If the output is not shown as above or there was no output at all,
     198      then something is wrong. Investigate and retrace the steps to find out
     199      where the problem is and correct it. This issue must be resolved before
     200      continuing on.</para>
     201
     202      <para>Once all is well, clean up the test files:</para>
    175203
    176204<screen><userinput>rm -v dummy.c a.out</userinput></screen>
    177205
    178   </caution>
    179 
    180   <note><para>Building Binutils in the section after next will serve as an
    181   additional check that the toolchain has been built properly. If Binutils
    182   fails to build, it is an indication that something has gone wrong with the
    183   previous Binutils, GCC, or Glibc installations.</para></note>
     206    </caution>
     207
     208    <note><para>Building packages in the next sections will serve as an
     209    additional check that the toolchain has been built properly. If some
     210    package, especially binutils-pass2 or gcc-pass2, fails to build, it is
     211    an indication that something has gone wrong with the
     212    previous Binutils, GCC, or Glibc installations.</para></note>
     213
     214    <para>Now that our cross-toolchain is complete, finalize the installation
     215    of the limits.h header. For doing so, run an utility provided by the GCC
     216    developers:</para>
     217
     218<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
    184219
    185220  </sect2>
Note: See TracChangeset for help on using the changeset viewer.