CentOS 7 升级 gcc-4.8.5 到 gcc-5.4.0
1、环境介绍
[root@localhost ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/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 --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@localhost ~]# uname -r
3.10.0-957.el7.x86_64
2、下载gcc-5.4.0源码包
[root@localhost ~]# wget http://mirrors.nju.edu.cn/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gz
[root@localhost ~]# tar xf gcc-5.4.0.tar.gz
[root@localhost ~]# cd gcc-5.4.0/
[root@localhost gcc-5.4.0]# ./contrib/download_prerequisites
"./contrib/download_prerequisites会下载mpfr-2.4.2.tar.bz2 gmp-4.3.2.tar.bz2 mpc-0.8.1.tar.gz isl-0.14.tar.bz2这四个文件"
"下方的tar包里面已经创建好了gcc-build-5.4.0,执行./contrib/download_prerequisites所下载的依赖包也都下载好了,解压后,可以直接开始编译,包的大小为132.97MB"
"链接:https://pan.baidu.com/s/1bEQNC20SLQ3-psEirAzfVg"
"提取码:bfwg"
3、编译安装gcc
[root@localhost gcc-5.4.0]# mkdir gcc-build-5.4.0
[root@localhost gcc-5.4.0]# cd gcc-build-5.4.0/
[root@localhost gcc-build-5.4.0]# ../configure --enable-checking=release \
--enable-languages=c,c++ \
--with-arch_32=x86-64 \
--build=x86_64-redhat-linux \
--disable-multilib
[root@localhost gcc-build-5.4.0]# make && make install
"make && make install执行了大约1小时,可以喝喝茶,看看手机,站起来转两圈"
4、验证gcc版本
[root@localhost ~]# /usr/local/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-redhat-linux/5.4.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --with-arch_32=x86-64 --build=x86_64-redhat-linux --disable-multilib
Thread model: posix
gcc version 5.4.0 (GCC)
"编译的gcc在/usr/local/bin目录下,/usr/bin/gcc的版本依旧还是4.8.5的"
5、更新gcc连接
"保留一下4.8.5的gcc,后续需要回退的时候,可以方便很多"
[root@localhost ~]# mv /usr/bin/gcc{,-4.8.5}
[root@localhost ~]# mv /usr/lib64/libstdc++.so.6{,-4.8.5}
[root@localhost ~]# mv /usr/bin/g++{,-4.8.5}
[root@localhost ~]# ln -s /usr/local/bin/gcc /usr/bin/gcc
[root@localhost ~]# ln -s /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6
[root@localhost ~]# ln -s /usr/local/bin/g++ /usr/bin/g++
"这个时候gcc -v就可以看到gcc的版本变成5.4了"
[root@localhost ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-redhat-linux/5.4.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-checking=release --enable-languages=c,c++ --with-arch_32=x86-64 --build=x86_64-redhat-linux --disable-multilib
Thread model: posix
gcc version 5.4.0 (GCC)
CentOS 7 升级 gcc-4.8.5 到 gcc-5.4.0的更多相关文章
- CentOS 7 升级gcc/g++编译器
gcc的升级必须要使用源码进行升级,也就说,必须要使用源码进行编译才行.我的7.2的CentOS目前自带的gcc是4.8.5的,gcc从4.8之后开始支持C++11,但是鉴于现在C++14.C++17 ...
- centos 6升级 GCC 到4.8
centos 6升级 GCC 到4.8 安装最新版本的swoole 提示 pecl install swolle ... GCC 4.8 or later required. 首先想到的时候yum ...
- centos 7升级gcc到10.2.0
安装gcc 由于 Linux 操作系统的自由.开源,在其基础上衍生出了很多不同的 Linux 操作系统,如 CentOS.Ubuntu.Debian 等.这些 Linux 发行版中,大多数都默认装有 ...
- CENTOS 7 升级安装 Python 3.5
写在前面的话 本文采取源码的方式安装 Python 3.5.2,如果是其它版本会有或多或少的差异,且写这篇的时候官网最新的是 Python 3.7,个人使用 3.5 就足够了,没必要更新到最新,否则出 ...
- CentOS如何升级openssl到最新版本
本文不再更新,可能存在内容过时的情况,实时更新请移步原文地址:CentOS如何升级openssl到最新版本: 环境信息 CentOS Linux release 7.6.1810 (Core): Op ...
- centos 7 升级后yum install出现Exiting on user cancel
centos 7 升级后yum install出现Exiting on user cancel centos 7.x升级后用yum install进行安装时经常出现Exiting on user ca ...
- CentOS 7升级Python到3.5后yum出错
CentOS 7升级Python到3.5后,我跟以前CentOS 6一样,在/usr/bin/python创建了一个指向Python 3的软连接,然后将/usr/bin/yum的顶部的: !/usr/ ...
- 关闭centos自动升级内核
八.关闭Centos自动更新chkconfig --list yum-updatesd #显示当前系统状态yum-updatesd 0:关闭 1:关闭 2:启用 3:启用 4:启用 ...
- Linux:centos内核升级
centos内核升级 centos升级2.6内核到3.10 在yum的ELRepo源中,有 m ain l ine(3.13.1). l ong- t erm(3.10.28)这2个内核版本,long ...
- centos yum升级php
centos yum升级php5.3.3到最5.6.3 不要轻易升级,否则后果很严重! 注意事项: 1 升级后之前的php扩展不会丢失 自动会安装对应最新php的扩展2 升级后需重启下apache 才 ...
随机推荐
- MCU软件最佳实践——使用printf打印数据
在mcu上开发应用时,使用串口打印调试信息是最常用的调试手段之一.printf是c标准库提供的函数,可以方便输出格式化的信息.但针对不同的mcu芯片,printf函数要能正常工作,需要做一些移植和适配 ...
- 【刷题-PAT】A1095 Cars on Campus (30 分)
1095 Cars on Campus (30 分) Zhejiang University has 8 campuses and a lot of gates. From each gate we ...
- 【转载】ASP.NET前台代码绑定
ASP.NET前台代码绑定后台变量方法总结http://www.cnblogs.com/lerit/archive/2010/10/22/1858007.html ASP.NET前台无法访问后台int ...
- 项目管理软件jira安装
JIRA是Atlassian公司出品的项目与事务跟踪工具,被广泛应用于缺陷跟踪.客户服务.需求收集.流程审批.任务跟踪.项目跟踪和敏捷管理等工作领域. 官方文档https://confluence.a ...
- Iptables的命令与用法
目录 一:iptables的用法 1.iptables简介 二:Iptables链的概念 1.那四个表,有哪些作用? 2.那五条链,运行在那些地方? 3.Iptables流程图 三:iptables的 ...
- WTM多租户改造
首先简单说下多租户的几种实现方式 多租户(Multi-Tenant ),即多个租户共用一个实例,租户的数据既有隔离又有共享,说到底是要解决数据存储的问题. 常用的数据存储方式有三种. 方案一:独立数据 ...
- th 表达式的简单使用。
一.使用场景,页面中,循环遍历,获得控制器穿过来的值. 1.1 控制器 /** * 获得所有的图书信息 * @return */ @RequestMapping("/turnIndexPag ...
- mybatis 配置文件 简单介绍
配置文件? 一. properties属性:可以引入外部的属性文件,可以自定义属性信息,供后续的节点使用: 注意!外部文件 定义在SRC目录下 否则找不到资源.二. settings设置:全局的配置信 ...
- 计算机网络-5-10-TCP运输连接管理
TCP的运输连接管理 TCP是面向连接的通信,运输连接是用来传送TCP报文的,TCP运输连接的建立和释放是每一次面向连接的通信中必不可少的过程.因此,运输连接有三个阶段,即:建立连接,数据传送,连接释 ...
- Net6 DI源码分析Part1 ServiceCollection、ServiceDescriptor、ServiceLifetime、IServiceProvider
ServiceCollection.ServiceDescriptor.ServiceLifetime.IServiceProvider Microsoft.Extensions.Dependency ...