分享

【Centos 7】非编译升级gcc

落叶 发表于 2023-9-26 12:38:44 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 0 1294
第一步:安装centos-release-scl
[mw_shl_code=shell,true]yum install centos-release-scl[/mw_shl_code]

第二步:安装devtoolset(安装debtoolset / gcc),注意,如果想安装7.版本的,就改成devtoolset-7-gcc,以此类推,默认安装的devtoolset是在 /opt/rh 目录下的。
[mw_shl_code=shell,true]yum install devtoolset-8-gcc*[/mw_shl_code]

第三步:直接替换旧的gcc
[mw_shl_code=shell,true]mv /usr/bin/gcc /usr/bin/gcc-bak
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc

mv /usr/bin/g++ /usr/bin/g++-bak
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++[/mw_shl_code]

第四步:查看当前GCC版本
[mw_shl_code=shell,true]gcc --version[/mw_shl_code]
微信截图_20230926123832.png
Felix
2023年9月26日 12:37
回复

使用道具 举报

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则