How to upgrade gcc on CentOS6.5

How to upgrade gcc on CentOS6.5

Question: The default gcc version on CentOS6.5 is too old to build a particular application. How can I upgrade the version of gcc installed on CentOS6.5?

这里写图片描述

As of CentOS 6.5, the default version of gcc installed is 4.4.7. If you want to upgrade gcc on CentOS, you can install devtools, which is a CentOS version of Red Hat Developer Toolset. The devtools, which is available for CentOS 5 and 6, contains a suite of development tools including gcc, gdb, binutils, elfutils, etc. The devtools 1.1. offers gcc version 4.7.2.

To install devtools on CentOS, use the following commands.

$ sudo wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d
$ sudo sh -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo'
$ sudo yum install devtoolset-1.1

devtools will be installed under /opt/centos/devtoolset-1.1.

To use gcc from devtoolset, use the following command. This command will launch a new shell, wherein all environment variables are automatically set to use devtools.

$ scl enable devtoolset-1.1 bash
$ gcc --version

这里写图片描述

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++

参考:
http://ask.xmodulo.com/upgrade-gcc-centos.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值