To use recent versions of compilers such as gcc 11 on centos stream, install the gcc toolsets, eg gcc-toolset-11 which is in the AppStream repos.

Answer from jiopaley on Stack Overflow
🌐
Centos
cbs.centos.org › koji › buildinfo
devtoolset-11-gcc-11.2.1-1.1.el7 | Build Info | CentOS Community Build Service
October 19, 2021 - Main Site Links: · Summary · Packages · Builds · Tasks · Build Targets · Users · Hosts · Reports · Search
🌐
Centos
git1.centos.org › rpms › devtoolset-11 › releases
Releases - rpms/devtoolset-11 - CentOS Git server
devtoolset-11-imports/c7/devtoolset-11-11.0-3.el7.zip · devtoolset-11-imports/c7/devtoolset-11-11.0-3.el7.tar.gz · Powered by Pagure 5.14.1 ·
🌐
Centmin Mod
community.centminmod.com › threads › devtoolset-11-gcc-11-2-1.22340
Devtoolset-11 (GCC-11.2.1) | Centmin Mod Community Support Forums
June 8, 2022 - The main package for devtoolset-11 (devtoolset-11-11.0-3.el7.x86_64.rpm) software collection is already available on CentOS Mirror DEVTOOLSETELEVEN ??
🌐
GitHub
github.com › pypa › manylinux › issues › 1266
devtoolset-11 for manylinux_2014 · Issue #1266 · pypa/manylinux
January 27, 2022 - Last year we had the upgrade to devtoolset-10 for manylinux_2014 see #1141 and #1155. Now the devtoolset-11 is also released for CentOS 7. See below: https://centos.pkgs.org/7/centos-sclo-rh-x86_64/devtoolset-11-toolchain-11.0-3.el7.x86_...
Author   pypa
🌐
GitHub
github.com › nealef › clefos › issues › 9
yum -y install devtoolset-11-* failing with `No package devtoolset-11-* available.` · Issue #9 · nealef/clefos
January 29, 2022 - It seems that devtoolset-11 has not been rebuild yet for clefos 7. Is this planned and if so, do you have an ETA on this ? This has been found when investigating pypa/manylinux#1266 CentOS 7 sources are available for devtoolset-11: https://vault.centos.org/centos/7/sclo/Source/rh/ The CentOS 7 x86_64 image is able to run the same commands as below successfully.
Author   nealef
🌐
Fedora Discussion
discussion.fedoraproject.org › team workflows › projects in copr
mayeut/devtoolset-11 - Fedora Discussion
January 29, 2022 - Description devtoolset-11 rebuild for centos 7 i686 Installation Instructions yum install devtoolset-11-binutils devtoolset-11-gcc [...] Active Releases The following unofficial repositories are provided as-is by owner of this project. Contact the owner directly for bugs or issues (IE: not bugzilla).
🌐
CERN
linuxsoft.cern.ch › cern › centos › 7 › sclo › x86_64 › rh › repoview › devtoolset-11-gdb.html
devtoolset-11-gdb
CentOS 7 - SCL for x86_64: unspecified: devtoolset-11-gdb · Jump to letter: [ CDGHLMNPRSTV ]
Find elsewhere
🌐
Centos
git.centos.org › devtoolset-11-gcc
Index of /devtoolset-11-gcc
This directory tree contains sources used to build src.rpm from git for SIGs You can also find older centos 7/8/8-stream sources (archived).
🌐
Red Hat
access.redhat.com › documentation › en-us › red_hat_developer_toolset › 11 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 11 | Red Hat Documentation
July 19, 2023 - In Red Hat Developer Toolset, the GNU C++ compiler is provided by the devtoolset-11-gcc-c++ package and is automatically installed with the devtoolset-11-toolchain package as described in Section 1.5, “Installing Red Hat Developer Toolset”. To compile a C++ program on the command line, run the g++ compiler as follows: scl enable devtoolset-11 'g++ -o output_file source_file...'
🌐
Ahelpme
ahelpme.com › home › linux › centos 7 › how to install new gcc and development tools under centos 7
How to install new gcc and development tools under CentOS 7 | Any IT here? Help Me!
September 5, 2019 - [srv@local ~]# yum install ...=================== Installing: devtoolset-7-gcc x86_64 7.3.1-5.4.el7 centos-sclo-rh 29 M devtoolset-7-gcc-c++ x86_64 7.3.1-5.4.el7 centos-sclo-rh 11 M devtoolset-7-gcc-gdb-plugin x86_64 7.3.1-5.4.el7 centos-sclo-rh 123 k devtoolset-7-gcc-gfortran ...
🌐
Centos
buildlogs.centos.org › centos › 7 › sclo › x86_64 › rh › Packages › d
Index of /centos/7/sclo/x86_64/rh/Packages/d
This server contains a mix of raw/unsigned packages and/or build logs It should be used mainly for testing purposes
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Newest 'devtoolset' Questions - Stack Overflow
I'm facing a strange error ("reference to 'list' is ambiguous") in compiling a C++ 3rd party software under CentOS 7 with devtoolset-11.
Top answer
1 of 5
93

In your ~/.bashrc or ~/.bash_profile Simply source the "enable" script provided with the devtoolset. For example, with the Devtoolset 2, the command is:

source /opt/rh/devtoolset-2/enable

or

source scl_source enable devtoolset-2

Lot more efficient: no forkbomb, no tricky shell

2 of 5
17

An alternative of source /opt/rh/devtoolset-4/enable is

source scl_source enable devtoolset-4

The above shell script scl_source is more elegant than using a hard coded path (may be different on another machine). However scl_source does less because /opt/rh/devtoolset-4/enable uses scl_source and other stuff.

To use scl_source you may have to upgrade package scl-utils

yum update scl-utils  # old scl-utils versions miss scl_source

Quick copy-paste

echo 'source scl_source enable devtoolset-4' >> ~/.bashrc
    # Do not forget to change the version ↑

Source code for curious people

An example of scl_source source code:
https://gist.github.com/bkabrda/6435016

The scl_source installed on my Red Hat 7.1

#!/bin/bash

_scl_source_help="Usage: source scl_source <action> [<collection> ...]

Don't use this script outside of SCL scriptlets!

Options:
    -h, --help    display this help and exit"

if [ $# -eq 0 -o $1 = "-h" -o $1 = "--help" ]; then
    echo "$_scl_source_help"
    return 0
fi


if [ -z "$_recursion" ]; then
    _recursion="false"
fi
if [ -z "$_scl_scriptlet_name" ]; then
    # The only allowed action in the case of recursion is the same
    # as was the original
    _scl_scriptlet_name=$1
fi
shift 1

if [ -z "$_scl_dir" ]; then
    # No need to re-define the directory twice
    _scl_dir=/etc/scl/conf
    if [ ! -e $_scl_dir ]; then
        _scl_dir=/etc/scl/prefixes
    fi
fi

for arg in "$@"; do
    _scl_prefix_file=$_scl_dir/$arg
    _scl_prefix=`cat $_scl_prefix_file 2> /dev/null`
    if [ $? -ne 0 ]; then
        echo "Can't read $_scl_prefix_file, $arg is probably not installed."
        return 1
    fi

    # First check if the collection is already in the list
    # of collections to be enabled
    for scl in ${_scls[@]}; do
        if [ $arg == $scl ]; then
            continue 2
        fi
    done

    # Now check if the collection isn't already enabled
    /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null
    if [ $? -ne 0 ]; then
        _scls+=($arg)
        _scl_prefixes+=($_scl_prefix)
    fi;
done

if [ $_recursion == "false" ]; then
    _i=0
    _recursion="true"
    while [ $_i -lt ${#_scls[@]} ]; do
        _scl_scriptlet_path="${_scl_prefixes[$_i]}/${_scls[$_i]}/${_scl_scriptlet_name}"
        source "$_scl_scriptlet_path"
        if [ $? -ne 0 ]; then
            echo "Can't source $_scl_scriptlet_name, skipping."
        else
            export X_SCLS="${_scls[$_i]} $X_SCLS"
        fi;
        _i=$(($_i+1))
    done
    _scls=()
    _scl_prefixes=()
    _scl_scriptlet_name=""
    _recursion="false"
fi