From subsecret
Jump to: navigation, search

libelf

tar xf libelf-0.8.9.tar.gz
cd libelf-0.8.9
./configure --prefix=/tools/
make -j 8
make install
cd ..

GMP

tar xf gmp-5.1.1.tar.xz
cd gmp-5.1.1
./configure --prefix=/tools/
make -j 8
make install
cd ..

MPFR

tar xf mpfr-3.1.2.tar.xz
cd mpfr-3.1.2
./configure --with-gmp=/tools --prefix=/tools/
make -j 8 install
cd ..

MPC

tar xf mpc-1.0.1.tar.gz
cd mpc-1.0.1
./configure --with-gmp=/tools --with-mpfr=/tools --prefix=/tools/
make -j 8
make install
cd ..

GCC

Now we change dynamic linker variable for compiling GCC with right version of libraries.

export LD_LIBRARY_PATH=/tools/lib
tar xf gcc-4.8.0.tar.bz2
cd gcc-4.8.0/

Go to gcc/config/i386 and edit linux64.h and linux.h.

in linux.h

#define GLIBC_DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"

in linux64.h

#define GLIBC_DYNAMIC_LINKER32 "/tools/lib/ld-linux.so.2"
#define GLIBC_DYNAMIC_LINKER64 "/tools/lib/ld-linux-x86-64.so.2" 
cd ..
mkdir gccbuild
cd gccbuild
../gcc-4.5.2/configure --disable-multilib --with-mpfr=/tools --with-gmp=/tools --with-mpc=/tools --prefix=/tools/ --enable-languages=c,c++
make -j 12 
make install
cd ..
ln -s /tools/bin/gcc /tools/bin/cc

We are now ready for next step