http://www.linuxfromscratch.org/lfs/view/development/wget-list
I should have used:
http://www.linuxfromscratch.org/lfs/view/stable/wget-list
I noticed this when gcc did not patch correctly. To rectify this, I downloaded the correct sources and rebuilt gcc.
So, the first step after downloading the correct sources I untarred the gcc sources. It isn't necessary to use the "v" switch when untarring a tar file, but I like to see that something is happening. So here I untar the file:
tar jxvf gcc-4.6.1.tar.bz2
The extraction of the file creates a directory:
gcc-4.6.1
Next the source needs to be patched:
cd gcc-4.6.1
patch -Np1 -i ../gcc-4.6.1-startfiles_fix-1.patch
Then in following the directions laid out in the manual:
cp -v gcc/Makefile.in{,.orig}
sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp gcc/Makefile.in
cp -v gcc/Makefile.in{,.tmp} sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \ > gcc/Makefile.in
for file in \ $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.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 #define STANDARD_STARTFILE_PREFIX_1 "" #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file touch $file.orig done
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
Notice in some of the above lines, there is the "\".
This is the line continuation character. In other words all
could be on one line, but the continuation may make it clearer,
or because of the length needs to be continued on the next line.
Now while still in the gcc directory there are three files that need to be untarred and renamed:
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
Now create the build directory and cd to it:
mkdir -v ../gcc-build cd ../gcc-build
Now set things up to compile:
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-libgomp \ --without-ppl --without-cloog \ --with-mpfr-include=$(pwd)/../gcc-4.6.1/mpfr/src \ --with-mpfr-lib=$(pwd)/mpfr/src/.libs Now compile:
make
And install:
make install
Create a link:
ln -vs gcc /tools/bin/cc
Finally check the compiled gcc:
echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools'
If all went well, you should receive:
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
No comments:
Post a Comment