How to Install gcc 4.7.x/4.8.x on CentOS(scl devtools)

42 篇文章 0 订阅
38 篇文章 0 订阅
gcc 4.7.2
Tru Huynh of centos.org has built the redhat developer toolset 1.1, for centos and it contains gcc 4.7.2
So you could simply use his repo and install just gcc, instantly.
cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo
yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++

This will install it most likely into /opt/centos/devtoolset-1.1/root/usr/bin/
Then you can tell your compile process to use the gcc 4.7 instead of 4.4 with the CC variable
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc  
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++

gcc 4.8.1
wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++

usage
To use gcc from devtoolset, use the following command. This command will launch a new shell, wherein all environment variables are automatically set to usedevtools.
$ scl enable devtoolset-1.1 bash
$ gcc --version
gcc (GCC) 4.7.2 20121015 (Red Hat 4.7.2-5)

Alternatively, you can explicitly define the following variables to use devtools.
export CC=/opt/centos/devtoolset-1.1/root/usr/bin/gcc  
export CPP=/opt/centos/devtoolset-1.1/root/usr/bin/cpp
export CXX=/opt/centos/devtoolset-1.1/root/usr/bin/c++

To set this permanently, you have to add:
export PATH=/opt/centos/devtoolset-1.1/root/usr/bin/:$PATH
in your ~/.profile or ~./profile_bash or equivalent.

Remark:
https://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos
https://access.redhat.com/site/documentation/en-US/Red_Hat_Developer_Toolset/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cnzf1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值