1、操作系统版本
[root@node01 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
2、查看gcc版本
[root@node01 ~]# gcc -v
gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
3、安装scl
[root@node01 ~]# yum install centos-release-scl -y
[root@node01 ~]# yum list |grep gcc
4、安装gcc8
[root@node01 ~]# yum install -y devtoolset-8-gcc*
5、临时切换gcc
[root@node01 ~]# source /opt/rh/devtoolset-8/enable
6、查看gcc版本
[root@node01 ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-
linux/8/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-
languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-8/root/usr --
mandir=/opt/rh/devtoolset-8/root/usr/share/man --infodir=/opt/rh/devtoolset-
8/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --
enable-shared --enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --
enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only
--with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --
enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-
8.3.1-20190311/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-
gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-
redhat-linux
Thread model: posix
gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)
相关文档
评论