CentOS7快速升级gcc到高版本 原创 Linux平台 2021年8月3日 06:26 夏至未至 2092 当前内容 2887 字,在路上,马上到,马上到 #### 常见问题 诸如以下报错: Could not find devtoolset compiler in /opt/rh/devtoolset-10 configure: error: could not find a working compiler,see config.logl for details 文末提供yum源,有需要可以下载,直接从我环境下载下来的yum源,算是亲测了吧 #### 关于软件选集 CentOS7的一个第三方库SCL(软件选集[Software Collections])。 SCL可以在不覆盖原系统软件包的情况下安装新的软件包与老软件包共存, 避免把系统搞乱,并且可以使用 scl 命令切换。 #### 安装 SCL 源: yum install -y centos-release-scl scl-utils-build #### 列出 SCL 安装包源: yum list all --enablerepo='centos-sclo-rh' | grep "devtoolset-" ... devtoolset-10-oprofile.x86_64 1.4.0-1.el7 centos-sclo-rh devtoolset-10-oprofile-devel.x86_64 1.4.0-1.el7 centos-sclo-rh devtoolset-10-oprofile-jit.x86_64 1.4.0-1.el7 centos-sclo-rh devtoolset-10-perftools.x86_64 10.1-0.el7 centos-sclo-rh devtoolset-10-runtime.x86_64 10.1-0.el7 centos-sclo-rh devtoolset-10-strace.x86_64 5.7-3.el7 centos-sclo-rh devtoolset-10-systemtap.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-client.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-devel.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-initscript.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-runtime.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-runtime-python2.x86_64 devtoolset-10-systemtap-sdt-devel.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-server.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-systemtap-testsuite.x86_64 4.4-6.el7 centos-sclo-rh devtoolset-10-toolchain.x86_64 10.1-0.el7 centos-sclo-rh devtoolset-10-valgrind.x86_64 1:3.16.1-5.el7 centos-sclo-rh devtoolset-10-valgrind-devel.x86_64 1:3.16.1-5.el7 centos-sclo-rh ... #### 安装软件 安装高版本的gcc、gcc-c++、gdb,要哪个版本的就把命令中的数字`10`改成你要的主版本号就可以了,这样就升级到了你指定的版本 yum install -y devtoolset-10-toolchain 如果是 arm64 CentOS7 系统,需要选择 对应版本 #### 启动 gcc10 scl enable devtoolset-10 bash #### 验证版本 [root@node1]# gcc --version gcc (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11) Copyright (C) 2020 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. #### 退出当前scl bash环境,恢复成原系统bash环境 exit 退出后验证 [root@node1]# gcc --version gcc (GCC) 4.8.5 20210130 (Red Hat 4.8.5-44) Copyright (C) 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. #### 源下载 链接:https://pan.baidu.com/s/1FuYT ¥0.50 解锁全文 下载资源 本文标题: CentOS7快速升级gcc到高版本 本文作者: 夏至未至 发布时间: 2021年8月3日 06:26 最近更新: 2024年8月14日 09:32 原文链接: 许可协议: 署名-非商业性-禁止演绎 4.0 国际(CC BY-NC-ND 4.0) 请按协议转载并保留原文链接及作者 gcc(8) g++(6) arm64(1) 上一个 回调体验 下一个 L2Dwidget 添加多种动画人物 当前文章评论暂未开放,请移步至留言处留言。