使用devtoolset开发工具集安装高版本gcc
devtoolset
devtoolset,字面上可以理解为开发工具集
安装devtoolset工具
第一种方式:安装devtoolset-2-gcc-c++.x86_64
安装工具
yum -y install devtoolset-2-gcc-c++.x86_64
创建软连接
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
清除缓存
hash -r
查看版本号
gcc --version
第二种方式:更新yum源
安装GCC 4.8
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++
以下为替换系统GCC
export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc export
CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp export
CXX=/opt/rh/devtoolset-2/root/usr/bin/c++
以下为替换系统GCC
ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version
安装GCC 4.9
wget https://copr.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo -O /etc/yum.repos.d/devtools-3.repo
yum install devtoolset-3-gcc devtoolset-3-binutils devtoolset-3-gcc-c++
其它参照安装gcc4.8的命令,替换目录就行
安装GCC 5.2
wget https://copr.fedoraproject.org/coprs/hhorak/devtoolset-4-rebuild-bootstrap/repo/epel-6/hhorak-devtoolset-4-rebuild-bootstrap-epel-6.repo -O /etc/yum.repos.d/devtools-4.repo
yum install devtoolset-4-gcc devtoolset-4-binutils devtoolset-4-gcc-c++
其它参照安装gcc4.8的命令,替换目录就行