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://my.oschina.net/HeAlvin/blog/2051235

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值