001、系统信息
[root@PC1 software]# cat /etc/system-release CentOS Linux release 7.6.1810 (Core)
002、当前gcc编译器版本
[root@PC1 software]# gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) 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.
003、列出所有可用的gcc安装包
[root@PC1 software]# yum list devtoolset-*-gcc Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.bupt.edu.cn * centos-sclo-rh: mirrors.bupt.edu.cn * centos-sclo-sclo: mirrors.bupt.edu.cn * extras: mirrors.bupt.edu.cn * updates: mirrors.bupt.edu.cn Installed Packages devtoolset-11-gcc.x86_64 11.2.1-9.1.el7 @centos-sclo-rh Available Packages devtoolset-10-gcc.x86_64 10.2.1-11.2.el7 centos-sclo-rh devtoolset-11-annobin-plugin-gcc.x86_64 10.38-1.el7 centos-sclo-rh devtoolset-7-gcc.x86_64 7.3.1-5.16.el7 centos-sclo-rh devtoolset-8-gcc.x86_64 8.3.1-3.2.el7 centos-sclo-rh devtoolset-9-gcc.x86_64 9.3.1-2.2.el7 centos-sclo-rh
004、利用yum安装
[root@PC1 software]# yum -y install centos-release-scl [root@PC1 software]# yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils [root@PC1 software]# scl enable devtoolset-11 bash [root@PC1 software]# echo "source /opt/rh/devtoolset-11/enable" >>/etc/profile
005、测试当下的gcc版本
[root@PC1 software]# gcc --version gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) Copyright (C) 2021 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.
。
006、重启,测试是否长久生效
[root@PC1 software]# reboot
007、测试版本
[root@PC1 ~]# gcc --version gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) Copyright (C) 2021 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.
。
标签:11,gcc,centos,devtoolset,PC1,编译器,root,software From: https://www.cnblogs.com/liujiaxin2018/p/17561589.html