RHEL7工作站版如何安装devtoolset

How can I install devtoolset on the workstation edition of RHEL7

我想知道如何在 RHEL7 workstation 上安装 devtoolset。 我发现 instructions for RHEL7 server 未能针对工作站版本正确调整。 我还发现 instructions for CentOS7 适用于 CentOS7:

sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
which gcc
gcc --version

我在 RHEL7 工作站的任何存储库中都找不到 devtoolset 即使用:

>yum search --enablerepo=\* devtoolset
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Warning: No matches found for: devtoolset
No matches found
>yum search --enablerepo=\* scl
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
...
scl-utils.x86_64 : Utilities for alternative packaging

scl-utils 安装 scl 工具但不安装 devtoolset 软件集合本身。

上下文:我需要安装 gcc5 or later for template parameter support。但是,我想使用标准的 libstdc++ 和 ABI。 事实上,多年来我一直在为 RHEL7 自编译更高版本的 gcc。然而,它们使用更高版本的 libstdc++ 和 'new' ABI(参见 Forcing or preventing use of a particular minor version of libstdc++)。对于这种情况,我不想这样做,我想遵循正确的 'vendor' 说明,而不是从源代码编译。

本例中的这个问题是 RedHat 订阅频道。 虽然订阅和软件是免费的(前提是您已经有一个有效的订阅),但出于某种原因,您必须按照以下方式向 RedHat 提交 'special request':

https://access.redhat.com/solutions/472793

您可以通过访问自动执行此操作:

https://www.redhat.com/wapps/try/RHSCL

(登录支持门户时)。 这应该会自动获得批准,之后您可以附加新的订阅。 使用以下方法识别池 ID:

subscription-manager list --available --all

查找池 ID:

 Subscription Name:   Software Collections and Developer Toolset
 Provides:            Red Hat Developer Tools (for RHEL Server)
                      Red Hat Developer Tools Beta (for RHEL Workstation)
                      Red Hat Software Collections Beta (for RHEL Server)
                      Red Hat Software Collections Beta (for RHEL Workstation)
                      Red Hat Software Collections (for RHEL Server)
                      Red Hat Developer Tools Beta (for RHEL Server)
                      Red Hat Developer Toolset (for RHEL Workstation)
                      Red Hat Software Collections Beta (for RHEL Client)
                      Red Hat Software Collections (for RHEL Workstation)
                      Red Hat Developer Toolset (for RHEL Server)
                      Red Hat Developer Tools (for RHEL Workstation)
                      Red Hat Software Collections (for RHEL Client) 
SKU:                 foobar 
Contract:            1234 Pool ID: XXXXXXXXXX

然后附上这个并启用新的可用存储库:

>subscription-manager attach --pool=XXXXXXXXXXXXXXXXXXXX
Successfully attached a subscription for: Software Collections and Developer Toolset
>subscription-manager repos --enable rhel-workstation-rhscl-7-rpms
Repository 'rhel-workstation-rhscl-7-rpms' is enabled for this system.
>subscription-manager repos --enable rhel-7-workstation-devtools-rpms
Repository 'rhel-7-workstation-devtools-rpms' is enabled for this system.

您现在可以自由安装了:

>yum update -y 
>yum install -y devtoolset-7-gcc-c++

RedHat 解释了为什么他们让你跳过这么多圈套:

-If you have a 2013 RHEL SKU with Standard or Premium service level, there should be no action on your part, and your subscription should have full access to RHSCL.

-If you have a 2010 or older RHEL SKU with Standard or Premium service level, you should contact Red Hat Customer Service to request the RHSCL SKU (and all related content) added to your account.

NOTE: Developer Toolset is now included as part of Red Hat Software Collections. This change was made on May 29, 2014.

As you had Red Hat Enterprise Linux Workstation, Standard subscription which is older RHEL SKU with Standard service level, you had to initiate a special request for it