怎么在 CentOS7 中用高版本 GCC

以前是自己编译想要的 gcc 版本。从源码安装的好处是可以使用自己想用的 gcc 版本,缺点就是麻烦。

在编译 greenplum 时,发现有个通用处理方法来使用更高版本 GCC.

原文链接

这里记录一下 CentOS 上用到的命令:

yum install -y centos-release-scl
yum update
yum install devtoolset-7
scl enable devtoolset-7 bash

自 2024 年 7 月 1 号后,官方就不再维护 centos 7,相关资源库也已从官方仓库移除。需要使用 https://vault.centos.org.

yum install -y centos-release-scl 安装之后的文件 CentOS-SCLo-scl.repo 还包含 mirrors.centos.org, 因此需要替换里面的 url 为 vault.centos.org.

特别, 需要替换
baseurl=http://mirrors.centos.org/centos/7/sclo/$basearch/sclo 为 baseurl=http://vault.centos.org/centos/7/sclo/$basearch/rh/

posted on 2023-08-07 18:49  winter-loo  阅读(100)  评论(0)    收藏  举报

导航