Centos7升级GCC到高版本(Step by Step)
-
登陆进Centos7
yum -y update
-
安装GCC(先安低版本,再安高版本,高版本通过源码编译需要低版本的gcc去编译它,先有鸡才能有蛋)
yum -y install gcc
安装完确认一下
gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
Copyright © 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
As might be seen from the output, the GCC version distributed by CentOS 7 is 4.8.5 which is not the latest version of GCC.
然后安装gcc-c++
yum -y install gcc-c++
- 从源代码安装GCC
最好用screen开启一个新屏幕,实在是编译需要3个小时,等不及,主机睡了难过。或者后台运行编译。
screen -U -S gcc
下载gcc 7.3.0版本(你可以选择你喜