centos6 快速安装GCC9
作者:
Mr_我爱读文献 | 来源:发表于
2020-07-28 09:53 被阅读0次# 安装scl源
yum install centos-release-scl scl-utils-build -y
# 列出所有可用的scl源
yum list all --enablerepo='centos-sclo-rh' | grep "devtoolset-"
# 安装gcc9
yum install devtoolset-9-toolchain -y
# 启动环境
scl enable devtoolset-9 bash
gcc --version
# 永久环境
echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile
需要注意的是,在使用cmake3时,即使执行了上述操作,默认情况下cmake3命令还会使用系统原默认gcc版本。 这时需要在执行cmake3命令时添加以下内容:
cmake -D DCMAKE_C_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/gcc -D DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/g++
本文标题:centos6 快速安装GCC9
本文链接:https://www.haomeiwen.com/subject/tagxrktx.html
网友评论