1. Prerequisites:
You will need
- gmp 4.3.1-7.el6_2.2
- mpfr 2.4.1-6.el6
- mpc 0.19-1.el6.rf and
- isl-0.14
For 1 to 3, do take a look at Compiling GNU 4.8.1 on CentOS 6. For 4, do take look at Compiling isl-0.15 library
2a. Update linked library at /etc/ld.so.conf
# touch /etc/ld.so.conf.d/library.conf
/usr/local/isl-0.15/lib /usr/local/mpfr-2.4.2/lib /usr/local/mpc-0.8.1/lib /usr/local/gmp-4.3.2/lib
2b. Update your .bashrc
export LD_LIBRARY_PATH=/usr/local/mpfr-2.4.2/lib:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/isl-0.15/lib
3. Compile. This will take a while.
# tar -zxvf gcc-4.8.1.tar.gz # cd gcc-4.8.1 # mkdir build-gcc # cd build-gcc # ../configure --prefix=/usr/local/gcc-5.2.0 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-0.8.1 --with-gmp=/usr/local/gmp-4.3.2 --with-isl=/usr/local/isl-0.14 --disable-multilib --disable-libmpx --enable-shared --enable-languages=c,c++,fortran,go,objc,obj-c++ --host x86_64-redhat-linux-gnu --build x86_64-redhat-linux-gnu # make -j 16 # make install
References: