Wednesday, May 12, 2010

building gcc4.5 on linux

1) Download gcc sources:
svn co svn://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch
2) Download other resources required:
wget ftp://gcc.gnu.org:21/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget ftp://gcc.gnu.org:21/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget ftp://gcc.gnu.org:21/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.gz (might be needed)
3) build gmp, mpfr and mpc:
a) cd gmp-4.3.2
./configure --prefix=/usr/local
make
sudo make install
b) cd mpfr-2.4.2
./configure --prefix=/usr/local
make
sudo make install
c) cd mpc-0.8.1
./configure --prefix=/usr/local
make
sudo make install
NOTE: if it fails with 'relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC'
Make sure that you are using /usr/local/lib/libmpfr.so

4) cd gcc-4_5-branch
a) autoconf (it may ask for upgrading to 2.64)
b) LD_RUN_PATH=/usr/local/lib
export LD_RUN_PATH
LDFLAGS="-L/usr/local/lib -R/usr/local/lib"
export LDFLAGS
c) configure gcc:
./configure --prefix=/usr/local --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++ --disable-dssi --enable-plugin --with-cpu=generic --host=x86_64-redhat-linux --build=x86_64-redhat-linux --with-gmp=/usr/local/ --with-mpfr=/usr/local/ --with-mpc=/usr/local
d) make
e) sudo make install

No comments:

Post a Comment