CentOS下通過devtoolset源安裝gcc特定版本 原 薦

CentOS下某些軟件的安裝需要gcc特定版本或者高版本(python27編譯安裝),這裏可通過添加devtoolset源安裝gcc的特定版本

http://puias.princeton.edu/data/puias/DevToolset/

http://people.centos.org/tru/

http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo

 

CentOS 6.5 x86_64

 

#gcc 4.7

cat devtools-1.1.repo

[testing-1.1-devtools-$releasever]

name=testing 1.1 devtools for CentOS $releasever

baseurl=http://puias.princeton.edu/data/puias/DevToolset/$releasever/$basearch/

#baseurl=http://people.centos.org/tru/devtools-1.1/$releasever/$basearch/RPMS

gpgcheck=0

 

/opt/rh/devtoolset-1.1/root/usr/bin/gcc --version

gcc (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5)

Copyright (C) 2012 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

 

#gcc 4.8

cat devtools-2.repo

[testing-devtools-2-centos-$releasever]

name=testing 2 devtools for CentOS $releasever

baseurl=http://puias.princeton.edu/data/puias/DevToolset/$releasever/$basearch/

#baseurl=http://people.centos.org/tru/devtools-2/$releasever/$basearch/RPMS

gpgcheck=0

 

/opt/rh/devtoolset-2/root/usr/bin/gcc --version

gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

Copyright (C) 2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

 

 

#gcc 4.9

cat devtools-3.repo

[rhscl-devtoolset-3]

name=Copr repo for devtoolset-3 owned by rhscl

baseurl=https://copr-be.cloud.fedoraproject.org/results/rhscl/devtoolset-3/epel-6-$basearch/

type=rpm-md

skip_if_unavailable=True

gpgcheck=1

gpgkey=https://copr-be.cloud.fedoraproject.org/results/rhscl/devtoolset-3/pubkey.gpg

repo_gpgcheck=0

enabled=1

enabled_metadata=1

 

/opt/rh/devtoolset-3/root/usr/bin/gcc --version

gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)

Copyright (C) 2014 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

 

#gcc 5.2

cat devtools-4.repo

[hhorak-devtoolset-4-rebuild-bootstrap]

name=Copr repo for devtoolset-4-rebuild-bootstrap owned by hhorak

baseurl=https://copr-be.cloud.fedoraproject.org/results/hhorak/devtoolset-4-rebuild-bootstrap/epel-6-$basearch/

type=rpm-md

skip_if_unavailable=True

gpgcheck=1

gpgkey=https://copr-be.cloud.fedoraproject.org/results/hhorak/devtoolset-4-rebuild-bootstrap/pubkey.gpg

repo_gpgcheck=0

enabled=1

enabled_metadata=1

 

/opt/rh/devtoolset-4/root/usr/bin/gcc --version

gcc (GCC) 5.2.1 20150902 (Red Hat 5.2.1-2)

Copyright (C) 2015 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

以gcc-4.8.2爲例

臨時編譯使用

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/centos/devtoolset-2/root/usr/bin/* /usr/local/bin/

hash -r #清除hash表

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章