diff options
author | Jeremy Huntwork <jhuntwork@linuxfromscratch.org> | 2007-09-15 20:45:13 +0000 |
---|---|---|
committer | Jeremy Huntwork <jhuntwork@linuxfromscratch.org> | 2007-09-15 20:45:13 +0000 |
commit | b0a4c9a47dadc3ab2c37a034866cb542f3fffa0b (patch) | |
tree | fb6d77a8ace59cc4de2eec8cfb96a5cd29983fa1 /chapter05 | |
parent | 232aa7359d4f119b062bf270e19e8a4c1d2228a0 (diff) |
Upgrade to GCC-4.2.1. Fixes #2002. Merged from jh branch, thanks to Matthew Burgess for preparing a discrete patch.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8374 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter05')
-rw-r--r-- | chapter05/adjusting.xml | 2 | ||||
-rw-r--r-- | chapter05/gcc-pass1.xml | 29 | ||||
-rw-r--r-- | chapter05/gcc-pass2.xml | 55 | ||||
-rw-r--r-- | chapter05/perl.xml | 5 |
4 files changed, 55 insertions, 36 deletions
diff --git a/chapter05/adjusting.xml b/chapter05/adjusting.xml index bad013455..322d82c6b 100644 --- a/chapter05/adjusting.xml +++ b/chapter05/adjusting.xml @@ -48,7 +48,7 @@ ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld</userinput></screen> </important> <!-- Ampersands are needed to allow copy and paste --> -<screen><userinput>gcc -dumpspecs | sed 's@^/lib/ld-linux.so.2@/tools&@g' \ +<screen><userinput>gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \ > `dirname $(gcc -print-libgcc-file-name)`/specs</userinput></screen> <para>During the build process, GCC runs a script diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 068fdf698..5bbb78173 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -101,26 +101,15 @@ cd ../gcc-build</userinput></screen> </variablelist> - <para>Continue with compiling the package:</para> - -<screen><userinput>make bootstrap</userinput></screen> - - <variablelist> - <title>The meaning of the make parameter:</title> - - <varlistentry> - <term><parameter>bootstrap</parameter></term> - <listitem> - <para>This target does not just compile GCC, but compiles it - several times. It uses the programs compiled in a first round - to compile itself a second time, and then again a third time. - It then compares these second and third compiles to make sure - it can reproduce itself flawlessly. This also implies that it - was compiled correctly.</para> - </listitem> - </varlistentry> - - </variablelist> + <para>The following command will compile GCC not once, but several times. It + uses the programs compiled in a first round to compile itself a second time, + and then again a third time. It then compares these second and third compiles + to make sure it can reproduce itself flawlessly. This is called + <quote>bootstrapping</quote>. Building GCC in this way ensures that it was + compiled correctly and is now the default configuration for the released + package. Continue with compiling by running:</para> + +<screen><userinput>make</userinput></screen> <para>Compilation is now complete. At this point, the test suite would normally be run, but, as mentioned before, the test suite framework is diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml index 53743acb6..2be683d55 100644 --- a/chapter05/gcc-pass2.xml +++ b/chapter05/gcc-pass2.xml @@ -90,23 +90,39 @@ sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in</userin sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \ > gcc/Makefile.in</userinput></screen> - <para>Apply the following patch to change the location of GCC's default - dynamic linker (typically <filename - class="libraryfile">ld-linux.so.2</filename>):</para> - -<screen><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> - - <para>The above patch also removes <filename + <para>The following command will change the location of GCC's default + dynamic linker to use the one we installed in + <filename class="directory">/tools</filename>. It also removes <filename class="directory">/usr/include</filename> from GCC's include search path. - Patching now rather than adjusting the specs file after installation + Doing this now rather than adjusting the specs file after installation ensures that the new dynamic linker is used during the actual build of GCC. That is, all of the binaries created during the build will link - against the new Glibc.</para> - - <important> - <para>The above patch is critical in ensuring a successful overall - build. Do not forget to apply it.</para> - </important> + against the new Glibc. Issue:</para> + +<screen><userinput>for file in $(find gcc/config -name linux64.h -o -name linux.h) +do + cp -uv $file{,.orig} + sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ + -e 's@/usr@/tools@g' $file.orig > $file + echo " +#undef STANDARD_INCLUDE_DIR +#define STANDARD_INCLUDE_DIR 0" >> $file + touch $file.orig +done</userinput></screen> + + <para>In case the above seems hard to follow, let's break it down a bit. + First we find all the files under the gcc/config directory that are named + either <filename>linux.h</filename> or <filename>linux64.h</filename>. + For each file found, we copy it to a file of the same name but with an added + suffix of <quote>.orig</quote>. Then the first sed expression prepends + <quote>/tools</quote> to every instance of <quote>/lib/ld</quote>, + <quote>/lib64/ld</quote> or <quote>/lib32/ld</quote>, while the second one + replaces hard-coded instances of <quote>/usr</quote>. Then we add our define + statements which alter the include search path to the end of the file. Finally, + we use <command>touch</command> to update the timestamp on the copied files. + When used in conjunction with <command>cp -u</command>, this prevents unexpected + changes to the original files in case the command is inadvertently run twice. + </para> <para>Create a separate build directory again:</para> @@ -122,7 +138,7 @@ cd ../gcc-build</userinput></screen> --with-local-prefix=/tools --enable-clocale=gnu \ --enable-shared --enable-threads=posix \ --enable-__cxa_atexit --enable-languages=c,c++ \ - --disable-libstdcxx-pch</userinput></screen> + --disable-libstdcxx-pch --disable-bootstrap</userinput></screen> <variablelist> <title>The meaning of the new configure options:</title> @@ -177,6 +193,15 @@ cd ../gcc-build</userinput></screen> </listitem> </varlistentry> + <varlistentry> + <term><parameter>--disable-bootstrap</parameter></term> + <listitem> + <para>Bootstrapping the compiler is now the default for GCC. However, + our build method should provide us with a solid compiler without the + need to bootstrap each time.</para> + </listitem> + </varlistentry> + </variablelist> <para>Compile the package:</para> diff --git a/chapter05/perl.xml b/chapter05/perl.xml index 6e9a87b76..0885cbbec 100644 --- a/chapter05/perl.xml +++ b/chapter05/perl.xml @@ -48,6 +48,11 @@ <screen><userinput>patch -Np1 -i ../&perl-libc-patch;</userinput></screen> + <para>Fix an incompatibility with gcc-&gcc-version;:</para> + +<screen><userinput>mv -v makedepend.SH{,.orig} +sed 's/command /command[ -]/' makedepend.SH.orig > makedepend.SH</userinput></screen> + <para>Prepare Perl for compilation (make sure to get the 'Data/Dumper Fcntl IO POSIX' part of the command correct—they are all letters):</para> |