安裝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

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM