
Linux From Scratch - Version 7.0
47
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 linux.h, linux64.h or sysv4.h. For each file found, we copy it to a file of the
same name but with an added suffix of “.orig”. Then the first sed expression prepends “/tools” to every instance of
“/lib/ld”, “/lib64/ld” or “/lib32/ld”, while the second one replaces hard-coded instances of “/usr”. Then we add our
define statements which alter the include search path and the default startfile prefix to the end of the file. Finally, we
use touch to update the timestamp on the copied files. When used in conjunction with cp -u, this prevents unexpected
changes to the original files in case the commands are inadvertently run twice.
On x86_64, unsetting the multilib spec for GCC ensures that it won't attempt to link against libraries on the host:
case $(uname -m) in
x86_64)
for file in $(find gcc/config -name t-linux64) ; do \
cp -v $file{,.orig}
sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file
done
;;
esac
As in the first build of GCC it requires the GMP, MPFR and MPC packages. Unpack the tarballs and move them
into the required directory names:
tar -jxf ../mpfr-3.1.0.tar.bz2
mv -v mpfr-3.1.0 mpfr
tar -jxf ../gmp-5.0.2.tar.bz2
mv -v gmp-5.0.2 gmp
tar -zxf ../mpc-0.9.tar.gz
mv -v mpc-0.9 mpc
Create a separate build directory again:
mkdir -v ../gcc-build
cd ../gcc-build
Before starting to build GCC, remember to unset any environment variables that override the default optimization
flags.
Now prepare GCC for compilation:
CC="$LFS_TGT-gcc -B/tools/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
../gcc-4.6.1/configure --prefix=/tools \
--with-local-prefix=/tools --enable-clocale=gnu \
--enable-shared --enable-threads=posix \
--enable-__cxa_atexit --enable-languages=c,c++ \
--disable-libstdcxx-pch --disable-multilib \
--disable-bootstrap --disable-li/jointfilesconvert/297116/bgomp \
--without-ppl --without-cloog \
--with-mpfr-include=$(pwd)/../gcc-4.6.1/mpfr/src \
--with-mpfr-lib=$(pwd)/mpfr/src/.libs
Comentarios a estos manuales