腾讯云 centos 7 升级 gcc-c++

本文指导如何在 CentOS 7.6 上通过 yum 安装 devtoolset-8,配置并确认gcc 8.3.1的版本,包括安装过程和相关软件包的检查。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0. 目标,更新 devtoolset 这个库

1. 存储库注册

# yum install -y centos-release-scl

2. 安装(如果安装 gcc 9.* 版本,将下面的全部 8 换成 9

# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

# yum install -y devtoolset-8
# scl enable devtoolset-8 bash
... 略

# yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++
# scl enable devtoolset-8 bash
... 略

3. 各种确认

# which gcc
/opt/rh/devtoolset-8/root/usr/bin/gcc

# gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 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.

# yum info devtoolset-8
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ty1.mirror.newmediaexpress.com
 * centos-sclo-rh: ty1.mirror.newmediaexpress.com
 * centos-sclo-sclo: ty1.mirror.newmediaexpress.com
 * extras: ty1.mirror.newmediaexpress.com
 * updates: ty1.mirror.newmediaexpress.com
Installed Packages
Name        : devtoolset-8
Arch        : x86_64
Version     : 8.1
Release     : 1.el7
Size        : 2.2 k
Repo        : installed
From repo   : centos-sclo-rh
Summary     : Package that installs devtoolset-8
License     : GPLv2+
Description : This is the main package for devtoolset-8 Software Collection.

# yum info devtoolset-8-gcc
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ty1.mirror.newmediaexpress.com
 * centos-sclo-rh: ty1.mirror.newmediaexpress.com
 * centos-sclo-sclo: ty1.mirror.newmediaexpress.com
 * extras: ty1.mirror.newmediaexpress.com
 * updates: ty1.mirror.newmediaexpress.com
Installed Packages
Name        : devtoolset-8-gcc
Arch        : x86_64
Version     : 8.3.1
Release     : 3.1.el7
Size        : 71 M
Repo        : installed
From repo   : centos-sclo-rh
Summary     : GCC version 8
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Description : The devtoolset-8-gcc package contains the GNU Compiler Collection version 7.

# yum info devtoolset-8-gcc-c++
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ty1.mirror.newmediaexpress.com
 * centos-sclo-rh: ty1.mirror.newmediaexpress.com
 * centos-sclo-sclo: ty1.mirror.newmediaexpress.com
 * extras: ty1.mirror.newmediaexpress.com
 * updates: ty1.mirror.newmediaexpress.com
Installed Packages
Name        : devtoolset-8-gcc-c++
Arch        : x86_64
Version     : 8.3.1
Release     : 3.1.el7
Size        : 29 M
Repo        : installed
From repo   : centos-sclo-rh
Summary     : C++ support for GCC version 8
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection
            : version 8.  It includes support for most of the current C++ specification
            : and a lot of support for the upcoming C++ specification.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值