I did not know if you have already installed gmp, mpfr, mpc before build gcc4.6.3, if you did not, please refer to these to build GCC4.6.3:
and you could download all of the packages from my Share_Point or gcc mirror
And you could get all of these scripts(including gcc.4.6.3.conf) from HERE
1. build & install gmp:
tar jxf gmp-4.3.2.tar.bz2 &&cd gmp-4.3.2/
./configure --prefix=/usr/local/gmp
make &&make install
cd ..
2. build & install mpfr:
tar jxf mpfr-2.4.2.tar.bz2 ;cd mpfr-2.4.2/
./configure --prefix=/usr/local/mpfr -with-gmp=/usr/local/gmp
make &&make install
cd ..
3. build & install mpc:
tar xzf mpc-0.8.1.tar.gz ;cd mpc-0.8.1
./configure --prefix=/usr/local/mpc -with-mpfr=/usr/local/mpfr -with-gmp=/usr/local/gmp
make &&make install
cd ..
After build & install these libs, you could start to build & Install gcc4.6.3:
4. build & install gcc4.6.3
tar jxf gcc-4.6.3.tar.bz2 ;cd gcc-4.6.3
./configure --prefix=/usr/local/gcc -enable-threads=posix -disable-checking -disable-multilib -enable-languages=c,c++ -with-gmp=/usr/local/gmp -with-mpfr=/usr/local/mpfr/ -with-mpc=/usr/local/mpc/
if
[ $? -eq 0 ];then
echo "this gcc configure is success"
else
echo "this gcc configure is failed"
fi
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/
make && make install
[ $? -eq 0 ] && echo install success
5. set up the gcc env:
-- this is really important. or even you successfully built the GCC, you could not build hhvm successfully. the gcc.4.6.3.conf(find it in share point above).
cp gcc.4.6.3.conf /etc/ld.so.conf.d/gcc.4.6.3.conf
ldconfig
mv /usr/bin/gcc /usr/bin/gcc_old
mv /usr/bin/g++ /usr/bin/g++_old
mv /usr/bin/c++ /usr/bin/c++_old
ln -s -f /usr/local/gcc/bin/gcc /usr/bin/gcc
ln -s -f /usr/local/gcc/bin/g++ /usr/bin/g++
ln -s -f /usr/local/gcc/bin/c++ /usr/bin/c++
cp /usr/local/gcc/lib64/libstdc++.so.6.0.16 /usr/lib64/.
mv /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.bak
ln -s -f /usr/lib64/libstdc++.so.6.0.16 /usr/lib64/libstdc++.so.6
6. finished.
you could run gcc --version to check if the current gcc version is gcc4.6.3, and also need to check g++, to see if the version is changed to g++4.6.3 too.