Ignore:
Timestamp:
04/25/2012 07:26:21 PM (12 years ago)
Author:
Bruce Dubbs <bdubbs@…>
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, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, 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:
cd3c10c
Parents:
e625c49
Message:

Merge changes developed and tested in the jh branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9831 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter05/gcc-pass1.xml

    re625c49 r1a3e6a3  
    6363mv -v mpc-&mpc-version; mpc</userinput></screen>
    6464
     65    <para>The following command will change the location of GCC's default
     66    dynamic linker to use the one installed in <filename
     67    class="directory">/tools</filename>. It also removes <filename
     68    class="directory">/usr/include</filename> from GCC's include search path.
     69    Issue:</para>
     70
     71<screen><userinput remap="pre">for file in \
     72 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
     73do
     74  cp -uv $file{,.orig}
     75  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
     76      -e 's@/usr@/tools@g' $file.orig &gt; $file
     77  echo '
     78#undef STANDARD_STARTFILE_PREFIX_1
     79#undef STANDARD_STARTFILE_PREFIX_2
     80#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
     81#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
     82  touch $file.orig
     83done</userinput></screen>
     84
     85    <para>In case the above seems hard to follow, let's break it down a bit.
     86    First we find all the files under the <filename
     87    class="directory">gcc/config</filename> directory that are named either
     88    <filename>linux.h</filename>, <filename>linux64.h</filename> or
     89    <filename>sysv4.h</filename>.  For each file found, we copy it to a file of
     90    the same name but with an added suffix of <quote>.orig</quote>. Then the
     91    first sed expression prepends <quote>/tools</quote> to every instance of
     92    <quote>/lib/ld</quote>, <quote>/lib64/ld</quote> or
     93    <quote>/lib32/ld</quote>, while the second one replaces hard-coded
     94    instances of <quote>/usr</quote>. Next, we add our define statements which
     95    alter the default startfile prefix to the end of the file. Note that the
     96    trailing <quote>/</quote> in <quote>/tools/lib/</quote> is required.
     97    Finally, we use <command>touch</command> to update the timestamp on the
     98    copied files.  When used in conjunction with <command>cp -u</command>, this
     99    prevents unexpected changes to the original files in case the commands are
     100    inadvertently run twice.  </para>
     101
    65102    <para>The GCC documentation recommends building GCC outside of the
    66103    source directory in a dedicated build directory:</para>
     
    74111    --target=$LFS_TGT          \
    75112    --prefix=/tools            \
     113    --with-sysroot=$LFS        \
     114    --with-newlib              \
     115    --without-headers          \
     116    --with-local-prefix=/tools \
     117    --with-native-system-header-dir=/tools/include \
    76118    --disable-nls              \
    77119    --disable-shared           \
     
    84126    --disable-libquadmath      \
    85127    --enable-languages=c       \
    86     --without-ppl              \
    87     --without-cloog            \
    88128    --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \
    89129    --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen>
     
    91131    <variablelist>
    92132      <title>The meaning of the configure options:</title>
     133
     134      <varlistentry>
     135        <term><parameter>--with-newlib</parameter></term>
     136        <listitem>
     137          <para>Since a working C library is not yet available, this ensures
     138          that the inhibit_libc constant is defined when building libgcc. This prevents
     139          the compiling of any code that requires libc support.</para>
     140        </listitem>
     141      </varlistentry>
     142
     143      <varlistentry>
     144        <term><parameter>--without-headers</parameter></term>
     145        <listitem>
     146          <para>When creating a complete cross-compiler, GCC requires
     147          standard headers compatible with the target system. For our
     148          purposes these headers will not be needed. This switch prevents
     149          GCC from looking for them.</para>
     150        </listitem>
     151      </varlistentry>
     152
     153      <varlistentry>
     154        <term><parameter>--with-local-prefix=/tools</parameter></term>
     155        <listitem>
     156          <para>The local prefix is the location in the system that GCC will search
     157          for locally installed include files. The default is <filename>/usr/local</filename>.
     158          Setting this to <filename>/tools</filename> helps keep the host location of
     159          <filename>/usr/local</filename> out of this GCC's search path.</para>
     160        </listitem>
     161      </varlistentry>
     162
     163      <varlistentry>
     164        <term><parameter>--with-native-system-header-dir=/tools/include</parameter></term>
     165        <listitem>
     166          <para>By default GCC searches <filename>/usr/include</filename> for system
     167          headers. In conjunction with the sysroot switch, this would translate normally
     168          to <filename>$LFS/usr/include</filename>. However the headers that will be installed
     169          in the next two sections will go to <filename>$LFS/tools/include</filename>. This
     170          switch ensures that gcc will find them correctly. In the second pass of GCC, this
     171          same switch will ensure that no headers from the host system are found.</para>
     172        </listitem>
     173      </varlistentry>
    93174
    94175      <varlistentry>
     
    125206          <para>This option ensures that only the C compiler is built.
    126207          This is the only language needed now.</para>
    127         </listitem>
    128       </varlistentry>
    129 
    130       <varlistentry>
    131         <term><parameter>--without-ppl, --without-cloog</parameter></term>
    132         <listitem>
    133           <para>These switches prevent GCC from building against the PPL and
    134           CLooG libraries which may be present on the host system, but will not
    135           be available in the chroot environment.</para>
    136208        </listitem>
    137209      </varlistentry>
Note: See TracChangeset for help on using the changeset viewer.