Ticket #2461: toolchain.2.patch

File toolchain.2.patch, 6.0 KB (added by bdubbs@…, 15 years ago)

Another variation of the changes.

  • chapter05/toolchaintechnotes.xml

    old new  
    1717  to at any time during the process.</para>
    1818
    1919  <para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
    20   provide a temporary environment that can be chrooted into and from which can be
    21   produced a clean, trouble-free build of the target LFS system in <xref
    22   linkend="chapter-building-system"/>. Along the way, we separate the new system
    23   from the host system as much as possible, and in doing so, build a
    24   self-contained and self-hosted toolchain. It should be noted that the build
    25   process has been designed to minimize the risks for new readers and provide
    26   maximum educational value at the same time.</para>
     20  provide a temporary environment via the <command>chroot</command> command and
     21  where a clean, trouble-free build of the target LFS system in <xref
     22  linkend="chapter-building-system"/> can be produced. Along the way, we
     23  separate the new system from the host system as much as possible, and in
     24  doing so, build a self-contained and self-hosted toolchain.
     25  The build process has been designed to minimize the risks for new
     26  readers and to provide the most educational value at the same time.</para>
    2727
    2828  <important>
    2929    <para>Before continuing, be aware of the name of the working platform,
     
    9898  <para>The next package installed is GCC. An example of what can be
    9999  seen during its run of <command>configure</command> is:</para>
    100100
    101 <screen><computeroutput>checking what assembler to use...
    102         /tools/i686-pc-linux-gnu/bin/as
    103 checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld</computeroutput></screen>
     101<screen><computeroutput>checking what assembler to use... /tools/i686-lfs-linux-gnu/bin/as
     102checking what linker to use... /tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
    104103
    105104  <para>This is important for the reasons mentioned above. It also demonstrates
    106105  that GCC's configure script does not search the PATH directories to find which
     
    117116
    118117  <para>The next package installed is Glibc. The most important considerations
    119118  for building Glibc are the compiler, binary tools, and kernel headers. The
    120   compiler is generally not an issue since Glibc will always use the
    121   <command>gcc</command> found in a <envar>PATH</envar> directory. The binary
    122   tools and kernel headers can be a bit more complicated. Therefore, take no
    123   risks and use the available configure switches to enforce the correct
    124   selections. After the run of <command>configure</command>, check the contents
    125   of the <filename>config.make</filename> file in the <filename
     119  compiler is generally not an issue since Glibc will always use the compiler
     120  relating to the <parameter>--host</parameter> parameter passed to its
     121  configure script, e.g. in our case,
     122  <command>i686-lfs-linux-gnu-gcc</command>. The binary tools and kernel
     123  headers can be a bit more complicated. Therefore, take no risks and use the
     124  available configure switches to enforce the correct selections. After the run
     125  of <command>configure</command>, check the contents of the
     126  <filename>config.make</filename> file in the <filename
    126127  class="directory">glibc-build</filename> directory for all important details.
    127   Note the use of <parameter>CC="gcc -B/tools/bin/"</parameter> to control which
    128   binary tools are used and the use of the <parameter>-nostdinc</parameter>
    129   and <parameter>-isystem</parameter> flags to control the compiler's include
     128  Note the use of <parameter>CC="i686-lfs-gnu-gcc"</parameter> to control which
     129  binary tools are used and the use of the <parameter>-nostdinc</parameter> and
     130  <parameter>-isystem</parameter> flags to control the compiler's include
    130131  search path. These items highlight an important aspect of the Glibc
    131132  package&mdash;it is very self-sufficient in terms of its build machinery and
    132133  generally does not rely on toolchain defaults.</para>
    133134
    134   <para>After the Glibc installation, make some adjustments to ensure that
    135   searching and linking take place only within the <filename
    136   class="directory">/tools</filename> prefix.  Install an adjusted
    137   <command>ld</command>, which has a hard-wired search path limited to
    138   <filename class="directory">/tools/lib</filename>. Then amend
    139   <command>gcc</command>'s specs file to point to the new dynamic linker in
    140   <filename class="directory">/tools/lib</filename>. This last step is vital
    141   to the whole process. As mentioned above, a hard-wired path to a dynamic
    142   linker is embedded into every Executable and Link Format (ELF)-shared
    143   executable.  This can be inspected by running:
     135  <para>After the Glibc installation, change <command>gcc</command>'s specs file
     136  to point to the new dynamic linker in <filename
     137  class="directory">/tools/lib</filename>.  This last step is vital in ensuring
     138  that searching and linking take place only within the <filename
     139  class="directory">/tools</filename> prefix. As mentioned above, a hard-wired
     140  path to a dynamic linker is embedded into every Executable and Link Format
     141  (ELF)-shared executable.  This can be inspected by running:
    144142  <userinput>readelf -l &lt;name of binary&gt; | grep interpreter</userinput>.
    145143  Amending gcc's specs file ensures that every program compiled from here
    146144  through the end of this chapter will use the new dynamic linker in
     
    164162  linkend="chapter-building-system"/>, the first major package to be
    165163  installed is Glibc, due to its self-sufficient nature mentioned above.
    166164  Once this Glibc is installed into <filename
    167   class="directory">/usr</filename>, perform a quick changeover of the
    168   toolchain defaults, then proceed in building the rest of the target
     165  class="directory">/usr</filename>, we will perform a quick changeover of the
     166  toolchain defaults, and then proceed in building the rest of the target
    169167  LFS system.</para>
    170168
    171169  <!-- FIXME: Removed as part of the fix for bug 1061 - we no longer build pass1