通过yum升级gcc/g++至版本4.8.2

最近在坐一个日期处理的问题,需要安装sxtwl模块,但是gcc版本4.7死活也安装不上,最后测试到只能升级gcc版本到4.8才得以解决

[[email protected] bin]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
4.4.7版本的gcc是不识别c++11语法的。

下面是CentOS6.6将gcc升级至4.8.2的过程:

1. 安装仓库等

#安装仓库
wget http://people.centos.org/tru/devtools-2/devtools-2.repo
mv devtools-2.repo /etc/yum.repos.d

#升级gcc等
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++
新版本的gcc安装在/opt/rh/devtoolset-2/root/ 下。

2. 配置:

#保存以前的gcc
mv /usr/bin/gcc /usr/bin/gcc-4.4.7
mv /usr/bin/g++ /usr/bin/g++-4.4.7
mv /usr/bin/c++ /usr/bin/c++-4.4.7

#为新版本的gcc创建软连接
ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc
ln -s /opt/rh/devtoolset-2/root/usr/bin/c++ /usr/bin/c++
ln -s /opt/rh/devtoolset-2/root/usr/bin/g++ /usr/bin/g++
3. 检查:确认已经升级到4.8.2版本。

[[email protected]]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/dev/shm/home/centos/rpm/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC)

原文地址:https://www.cnblogs.com/chenjw-note/p/10147870.html

时间: 2024-08-10 22:30:19

通过yum升级gcc/g++至版本4.8.2的相关文章

【转】CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)

原文地址:https://www.cnblogs.com/lzpong/p/5755678.html 我这里是centos7 升级到gcc8.1,过程差不多,参考这篇文章,记录一下. ---原文--- CentOS 6.6 升级GCC G++ (当前最新GCC/G++版本为v6.1.0) 没有便捷方式, yum update....   yum install 或者 添加yum 的 repo 文件 也不行, 只能更新到 4.4.7! then,  只能手动编译安装了,那么开始第一步下载源代码吧,

UBUNTU 下怎样升级 gcc, g++

正如大家所知道的GCC并不支持"make uninstall". 一种推荐安装方式就是把GCC 安装在你自己指定的一个路径,当你不需要某个GCC版本的时候你只需要移除对应版本即可. 假设你已经有一个老的版本在你的系统中,最简单的方式就是: 1)添加PPA(Personal Package Archive)到里的程序仓库(repositories )里 2更新程序仓库(repositoris) 3)升级程序 sudo add-apt-repository ppa:ubuntu-toolc

UBUNTU 下如何升级 gcc, g++

正如大家所知道的GCC并不支持"make uninstall". 一种推荐安装方式就是把GCC 安装在你自己指定的一个路径,当你不须要某个GCC版本号的时候你仅仅须要移除相应版本号就可以. 如果你已经有一个老的版本号在你的系统中,最简单的方式就是: 1)加入?PPA(Personal Package Archive)到里的程序仓库(repositories )里 2更新程序仓库(repositoris) 3)升级程序 sudo add-apt-repository ppa:ubuntu

gcc/g++多版本切换 (ubuntu18.04)

使用Ubuntu18.04已经有一段时间了,在使用过程中经常需要处理不同软件的编译工作,但是这时候就遇到这样一个问题,那就是不同软件,甚至是同一个软件的不同版本都会使用不同版本的gcc/g++来进行编译. Ubuntu18.04中自带的gcc/g++ 版本为7.3, 这时候如果我们想要安装4.8版本的,那么命令如下: sudo apt-get install gcc-4.8 sudo apt-get install g++-4.8 安装成功后查看gcc/g++调用版本是否正确: 原文地址:htt

CentOS 升级GCC G++

没有便捷方式, yum update....   yum install 或者 添加yum 的 repo 文件 也不行, 只能更新到 4.4.7! then,  只能手动编译安装了,那么开始第一步下载源代码吧,GO! 1. 获取安装包并解压 wget http://ftp.gnu.org/gnu/gcc/gcc-6.1.0/gcc-6.1.0.tar.bz2 tar -jxvf gcc-6.1.0.tar.bz2 当然,http://ftp.gnu.org/gnu/gcc 里面有所有的gcc版本

CentOS6下用yum升级系统最新内核版本

首先当你决定升级内核时,要想清楚为什么升级内核,因为升级内核会带来很多麻烦.所以这种事情能避免就避免 导入 Public Key rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org 安装 ELRepo CentOS 5 rpm -Uvh http://www.elrepo.org/elrepo-release-5-5.el5.elrepo.noarch.rpm CentOS 6 rpm -Uvh http://www.elrepo

centos5.8升级gcc g++

cd /etc/yum.repos.dwget http://people.centos.org/tru/devtools-2/devtools-2.repoyum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++mv /usr/bin/gcc /usr/bin/gcc.bak4.1.2mv /usr/bin/c++ /usr/bin/c++.bak4.1.2mv /usr/bin/g++ /usr/bin/g

CentOS yum升级GCC到4.8

wget http://people.centos.org/tru/devtools-2/devtools-2.repo mv devtools-2.repo /etc/yum.repos.d yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ 三个安装包会被装在 /opt/rh/devtoolset-2/root/ 中 更新软连接: mv /usr/bin/gcc /usr/bin/gcc-4.4.7

[转]CentOS 5.3通过yum升级php到最新版本的方法

来自:www.jasonlitka.com/media 通过测试,方法三可行: 方法三 vim /etc/yum.repos.d/utterramblings.repo 输入 [utterramblings] name=Jason’s Utter Ramblings Repo baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://www.jasonli