How to Install gcc 4.7.x/4.8.x on CentOS
Solution 1:
Tru Huynh of centos.org has built the redhat developer toolset 1.1, for centos and it contains gcc 4.7.2
So you could simply use his repo and install just gcc, instantly.
cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++
This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/
Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++
Solution 2:
Here is how to get devtoolset-2 (including gcc 4.8.1)
This was taken from http://people.centos.org/tru/devtools-2/readme
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
Known issues:
- unsigned packages
- CentOS-6 devtoolset-2 needs devtoolset-2-ide which contains the whole Eclipse stack, but does not build yet
- CentOS-6 all the maven related file are not built either
Main changes from devtools-1.1:
-
/opt/centos
is no longer used -
/opt/rh
is now used as upstream (as SL version)