安装devtoolset-2:因由安装gcc 4.8而引起

下午,为了使用C++11某些特性,不得不安装更高版本的gcc4.7 或gcc 4.8

有两种方法:

一、通过下载源码的方式安装,不过这个有点麻烦,而且容易出问题,推荐第二个方案

二、安装devtoolset-2工具

具体步骤:

1、Save repository information as /etc/yum.repos.d/slc6-devtoolset.repo on your system,then install it using yum

wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
yum install devtoolset-2

 

2、在安装过程中出现了错误:找不到相关的GPG key,只要根据提示安装相应的GPG key 即可

rpm --import http://www.scientificlinux.org/documentation/gpg/RPM-GPG-KEY-cern

rpm --import http://www.scientificlinux.org/documentation/gpg/RPM-GPG-KEY-sl

3、重新安装即可

4、export

ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
hash -r
gcc --version

备注:

需要参考的几个网址:

Developer Toolset

Scientific Linux

Install gcc 4.7 on Centos

RedHat Developer Toolset

 

 

posted on 2014-02-01 22:21  K's Blog  阅读(5262)  评论(0编辑  收藏  举报

导航