码迷,mamicode.com
首页 > 其他好文 > 详细

发现问题 解决问题:How to upgrade gcc on CentOS

时间:2015-06-14 12:25:33      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:

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

技术分享

? ?

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 installdevtools, 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?gccversion 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

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

? ?

来自 <http://ask.xmodulo.com/upgrade-gcc-centos.html>

发现问题 解决问题:How to upgrade gcc on CentOS

标签:

原文地址:http://www.cnblogs.com/keedor/p/4574788.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!