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-pass2.xml

    re625c49 r1a3e6a3  
    4444    <title>Installation of GCC</title>
    4545
    46     <para>Versions of GCC later than 4.3 will treat this build as if
    47     it were a relocated compiler and disallow searching for startfiles in
    48     the location specified by <parameter>--prefix</parameter>. Since this
    49     will not be a relocated compiler, and the startfiles in
    50     <filename class="directory">/tools</filename> are crucial to building
    51     a working compiler linked to the libs in <filename class="directory">/tools</filename>,
    52     apply the following patch which partially reverts GCC to its old behavior:</para>
    53 
    54 <screen><userinput remap="pre">patch -Np1 -i ../&gcc-startfiles-patch;</userinput></screen>
     46    <para>Our first build of GCC has installed a couple of internal system
     47    headers.  Normally one of them, <filename>limits.h</filename> will in turn
     48    include the corresponding system <filename>limits.h</filename> header, in
     49    this case, <filename>/tools/include/limits.h</filename>. However, at the
     50    time of the first build of gcc <filename>/tools/include/limits.h</filename>
     51    did not exist, so the internal header that GCC installed is a partial,
     52    self-contained file and does not include the extended features of the
     53    system header. This was adequate for building the temporary libc, but this
     54    build of GCC now requires the full internal header.  Create a full version
     55    of the internal header using a command that is identical to what the GCC
     56    build system does in normal circumstances:</para>
     57
     58<screen><userinput remap="pre">cat gcc/limitx.h gcc/glimits.h gcc/limity.h &gt; \
     59  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h</userinput></screen>
    5560
    5661    <para>Under normal circumstances the GCC <command>fixincludes</command> script
     
    7782  &gt; gcc/Makefile.in</userinput></screen>
    7883
    79     <para>The following command will change the location of GCC's default
    80     dynamic linker to use the one installed in
    81     <filename class="directory">/tools</filename>. It also removes <filename
    82     class="directory">/usr/include</filename> from GCC's include search path.
    83     Doing this now rather than adjusting the specs file after installation
    84     ensures that the new dynamic linker is used during the actual build of
    85     GCC. That is, all of the binaries created during the build will link
    86     against the new Glibc. Issue:</para>
     84    <para>Once again, change the location of GCC's default dynamic linker to
     85    use the one installed in <filename
     86    class="directory">/tools</filename>.</para>
    8787
    8888<screen><userinput remap="pre">for file in \
     
    9595#undef STANDARD_STARTFILE_PREFIX_1
    9696#undef STANDARD_STARTFILE_PREFIX_2
    97 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib"
     97#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
    9898#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
    9999  touch $file.orig
    100100done</userinput></screen>
    101 
    102     <para>In case the above seems hard to follow, let's break it down a bit.
    103     First we find all the files under the
    104     <filename class="directory">gcc/config</filename> directory that are named
    105     either <filename>linux.h</filename>, <filename>linux64.h</filename> or
    106     <filename>sysv4.h</filename>.
    107     For each file found, we copy it to a file of the same name but with an added
    108     suffix of <quote>.orig</quote>. Then the first sed expression prepends
    109     <quote>/tools</quote> to every instance of <quote>/lib/ld</quote>,
    110     <quote>/lib64/ld</quote> or <quote>/lib32/ld</quote>, while the second one
    111     replaces hard-coded instances of <quote>/usr</quote>. Then we add our define
    112     statements which alter the include search path and the default startfile prefix
    113     to the end of the file.
    114     Finally, we use <command>touch</command> to update the timestamp on the copied files.
    115     When used in conjunction with <command>cp -u</command>, this prevents unexpected
    116     changes to the original files in case the commands are inadvertently run twice.
    117     </para>
    118 
    119     <para>On x86_64, unsetting the multilib spec for GCC ensures that it
    120     won't attempt to link against libraries on the host:</para>
    121 
    122 <screen><userinput remap="pre">case $(uname -m) in
    123   x86_64)
    124     for file in $(find gcc/config -name t-linux64) ; do \
    125       cp -v $file{,.orig}
    126       sed '/MULTILIB_OSDIRNAMES/d' $file.orig &gt; $file
    127     done
    128   ;;
    129 esac</userinput></screen>
    130101
    131102    <para>As in the first build of GCC it requires the GMP, MPFR and MPC
     
    150121    <para>Now prepare GCC for compilation:</para>
    151122
    152 <screen><userinput remap="configure">CC="$LFS_TGT-gcc -B/tools/lib/" \
     123<screen><userinput remap="configure">CC="$LFS_TGT-gcc" \
    153124AR=$LFS_TGT-ar                  \
    154125RANLIB=$LFS_TGT-ranlib          \
     
    156127    --prefix=/tools             \
    157128    --with-local-prefix=/tools  \
     129    --with-native-system-header-dir=/tools/include \
    158130    --enable-clocale=gnu        \
    159131    --enable-shared             \
     
    165137    --disable-bootstrap         \
    166138    --disable-libgomp           \
    167     --without-ppl               \
    168     --without-cloog             \
    169139    --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \
    170140    --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen>
Note: See TracChangeset for help on using the changeset viewer.