CentOS6.6 update gcc4.8 tutorial
Recently, if you want to upgrade mesos0.23.0, gcc4.8 + is required for compiling mesos0.23.0. However, gcc of centos 6.6 is only available in version 4.4.7, so you have to manually upgrade it.
Download 4.8.2 source code
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2
Download dependencies (gmp-4.3.2, mpfr-2.4.2, mpc-0.8.1)
/usr/install/gcc-4.8.2/contrib/download_prerequisities
Compile and install dependencies in sequence
cd /usr/install/gcc-4.8.2/contrib/gmpmkdir buildcd build../configure --prefix=/usr/local/gcc/gmp-4.3.2sudo makesudo make installcd /usr/install/gcc-4.8.2/contrib/mpfrmkdir buildcd build../configure --prefix=/usr/local/gcc/mpfr-2.4.2 --with-gmp=/usr/local/gcc/gmp-4.3.2 sudo makesudo make installcd /usr/install/gcc-4.8.2/contrib/mpcmkdir buildcd build../configure --prefix=/usr/local/gcc/mpc-0.8.1 --with-mpfr=/usr/local/gcc/mpfr-2.4.2 --with-gmp=/usr/local/gcc/gmp-4.3.2 sudo makesudo make install
Compile and install gcc4.8.2
cd /usr/install/gcc-4.8.2mkdir build../configure --prefix=/usr/local/gcc --enable-threads=posix --disable-checking --enable-languages=c,c++ --disable-multilib --with-gmp=/usr/local/gcc/gmp-4.3.2 --with-mpfr=/usr/local/gcc/mpfr-2.4.2 --with-mpc=/usr/local/gcc/mpc-0.8.1sudo makesudo make install
Uninstall old version
yum remove -y gcc gcc-c++updatedb
Link to new version
cd /usr/bin ln -s /usr/local/gcc/bin/gcc gcc ln -s /usr/local/gcc/bin/g++ g++
Check version
gcc -v
Done