CentOS 7にgcc 9をインストール(SCL)


はじめに

Software Collection(SCL)を利用してCentOS7にgcc9をインストール
参考:Quick Start — Software Collections (2020-07-01現在掲載なし)
   Red Hat Software Collections 3.5 and Red Hat Developer Toolset 9.1 now generally available
   9.1 Release Notes Red Hat Developer Toolset 9 | Red Hat Customer Portal

サポート

本手法で導入した場合、Red Hat Software Collections Product Life Cycle - Red Hat Customer Portalより、2021-12がEOLだと思われる。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。

LOG

レポジトリ登録

# yum install -y centos-release-scl

インストール

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

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

各種確認

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

# gcc --version
gcc (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)
Copyright (C) 2019 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-9
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * centos-sclo-rh: ftp.nara.wide.ad.jp
 * centos-sclo-sclo: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
Installed Packages
Name        : devtoolset-9
Arch        : x86_64
Version     : 9.0
Release     : 3.el7
Size        : 2.2 k
Repo        : installed
From repo   : centos-sclo-rh
Summary     : Package that installs devtoolset-9
License     : GPLv2+
Description : This is the main package for devtoolset-9 Software Collection.

# yum info devtoolset-9-gcc
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * centos-sclo-rh: ftp.nara.wide.ad.jp
 * centos-sclo-sclo: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
Installed Packages
Name        : devtoolset-9-gcc
Arch        : x86_64
Version     : 9.1.1
Release     : 2.6.el7
Size        : 76 M
Repo        : installed
From repo   : centos-sclo-rh
Summary     : GCC version 9
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Description : The devtoolset-9-gcc package contains the GNU Compiler Collection version 9.

# yum info devtoolset-9-gcc-c++
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp.nara.wide.ad.jp
 * centos-sclo-rh: ftp.nara.wide.ad.jp
 * centos-sclo-sclo: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * updates: ftp.nara.wide.ad.jp
Installed Packages
Name        : devtoolset-9-gcc-c++
Arch        : x86_64
Version     : 9.1.1
Release     : 2.6.el7
Size        : 31 M
Repo        : installed
From repo   : centos-sclo-rh
Summary     : C++ support for GCC  version 9
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 9.  It includes support for most of the current C++ specification
            : and a lot of support for the upcoming C++ specification.