前端之家收集整理的这篇文章主要介绍了
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表
原文链接:https://www.f2er.com/centos/377167.html