I used following steps on CentOS-7 and they worked fine for me:

yum install centos-release-scl
yum install devtoolset-10
scl enable devtoolset-10 bash

I used same flags which you used:

g++ -std=c++2a -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/dummy2.d" -MT"src/dummy2.o" -o "src/dummy2.o" "../src/dummy2.cpp"
Answer from Ashish Shirodkar on Stack Overflow
🌐
Centos
cbs.centos.org › koji › buildinfo
devtoolset-10-10.0-0.el7 | Build Info | CentOS Community Build Service
January 21, 2021 - Main Site Links: · Summary · Packages · Builds · Tasks · Build Targets · Users · Hosts · Reports · Search
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Newest 'devtoolset' Questions - Stack Overflow
I was trying to install devtoolset-8 in my slave node with no active internet connection running centos7. I am using all .rpm packages required as dependencies. During installation through rpm -ivh * ... ... I am trying to install graph-tool on a RHEL7 within a virtual environment; it uses both, Python 3 and gcc 7 or above. I am unable to use both of them within the same scl bash shell. [root@ ~]# scl ... ... We use devtoolset-10 in CentOS 7 ("Actual" default version of gcc in OS is 4.8.5, but in devtoolset we use 10.2.1 version, which is real actual version for project).
🌐
Red Hat
access.redhat.com › documentation › en-us › red_hat_developer_toolset › 10 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 10 | Red Hat Documentation
June 21, 2022 - This means that some new C++17 features, such as std::pmr::string, are not available on Red Hat Enterprise Linux 7, even when using the Red Hat Developer Toolset compiler. In Red Hat Developer Toolset, the GNU Fortran compiler is provided by the devtoolset-10-gcc-gfortran package and is ...
🌐
GitHub
github.com › llvm › llvm-project › issues › 54756
LLVM 14 breaks using lld with devtoolset-10 gcc on CentOS 7 · Issue #54756 · llvm/llvm-project
April 5, 2022 - Commit 815a120 removed support for --no-add-needed. However, this option is added by devtoolset-10 gcc on CentOS7: [sgiesecke@SDP_DevVM-sgiesecke gcc]$ scl enable devtoolset-10 -- gcc test.cc -fuse-ld=lld -B /bin -v Using ...
Author   llvm
🌐
Abysm
blog.abysm.org › 2016 › 03 › installing-developer-toolset-rhel-based-distributions
Installing Developer Toolset on RHEL-based Distributions · Kuan-Yi Li's Blog
March 25, 2016 - yum-config-manager --enable ...oftwarecollections/yum-conf-softwarecollections-2.0-1.el6.noarch.rpm" Install the version(s) of your choice. Yes, they can co-exist. yum install devtoolset-10 ·...
🌐
Vanehost
mirror.vanehost.com › centos › 7 › sclo › x86_64 › rh › Packages › d
Index of /centos/7/sclo/x86_64/rh/Packages/d/
84 devtoolset-10-libquadmath-d... 07-Jan-2022 12:39 211908 devtoolset-10-libubsan-devel-10.2.1-2.1.el7.x86..> 18-May-2021 15:01 211364 devtoolset-10-ltrace-0.7.91-1.el7.x86_64.rpm 18-May-2021 15:00 137156 devtoolset-10-make-4.2.1-1.el7.x86_64.rpm 18-May-2021 15:03 473608 ...
Find elsewhere
🌐
GitHub
github.com › nealef › clefos › issues › 8
yum install -y devtoolset-10-binutils ... is failing · Issue #8 · nealef/clefos
July 24, 2021 - It thus seems that devtoolset-10-runtime is missing from the repo. Furthermore, looking at the current version in CentOS 7, those are not the same (I understand there can be some delay between availability in CentOS and rebuild by ClefOS but just wanted to add that in case it's not expected on your end):
Author   nealef
🌐
Docker Hub
hub.docker.com › r › centos › devtoolset-7-toolchain-centos7
centos/devtoolset-7-toolchain-centos7 - Docker Image
FROM rhscl/devtoolset-7-toolchain-rhel7 USER 0 RUN yum install -y --setopt=tsflags=nodocs boost-devel && yum clean all -y USER 1001 Copy
🌐
Softwarecollections
softwarecollections.org › en › scls › rhscl › devtoolset-8
Developer Toolset 8 — Software Collections
# 1. Install a package with repository for your system: # On CentOS, install package centos-release-scl available in CentOS repository: $ sudo yum install centos-release-scl # On RHEL, enable RHSCL repository for you system: $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms # 2. Install the collection: $ sudo yum install devtoolset-8 # 3.
🌐
Oracle Linux
yum.oracle.com › repo › OracleLinux › OL7 › SoftwareCollections › x86_64
Oracle Linux 7 (x86_64) Software Collection 3.0 | Oracle, Software. Hardware. Complete.
Oracle Linux with Oracle enterprise-class support is the best Linux operating system (OS) for your enterprise computing needs.
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Highest scored 'devtoolset' questions - Stack Overflow
July 6, 2023 - We use devtoolset-10 in CentOS 7 ("Actual" default version of gcc in OS is 4.8.5, but in devtoolset we use 10.2.1 version, which is real actual version for project).
Top answer
1 of 2
16

I've confirmed that you can upgrade gcc from the default version 4.8 on centOS 7.

First, we need to install "Software Collections" in order to access some of the community packages including gcc v7

  • sudo yum install -y centos-release-scl

Next, we want to install a developer toolset. Depending on your needs, you may want a different devtoolset. Here I'm targeting 7:

  • sudo yum install -y devtoolset-7

Finally, you'll want to change over to gcc 7 as your default, launch a new shell session with the scl tool:

  • scl enable devtoolset-7 bash
2 of 2
1

Enable the software collection in the answer is only effective in the current shell. The scl utility will create a "child-shell" that set the PATH variables properly, so that in the new child-shell, the enabled software collections will be firstly searched. These settings obviously only take effective temporarily in the current shell.

To make it permanently effective, add the command, source /opt/rh/devtoolset-7/enable to the user's profile (~/.bash_profile or ~/.bashrc for RHEL based OS, like CentOS 7). Then, start a new shell and you will have the right tools available.

After execute scl enable devtoolset-7 bash, you will need to execute exit twice to exit the opened shell window, which verifies that the scl command created a new shell instance as a child process. There might be side-effect with creating a child-shell, so do not put this command in the ~/.bashrc profile, otherwise it will repeatedly create child-shell (non-login shell) as each shell will load the profile, resulting in a endless recursive loop. Put it in ~/.bash_profile, it will be loaded for only once (for the login shell), but you will need to exit twice every time.

But for development purpose, scl enable devtoolset-7 bash would be preferred, as you can exit the created child-shell, and then switch between different versions of the same software.


More details about the GCC version in python terminal:

The version info of the built-in Python in CentOS 7:

[root@conda condabuilder]# python
Python 2.7.5 (default, Nov 16 2020, 22:23:17) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

The version info of the user installed (via conda) Python on a system even without higher version of GCC installed:

[root@conda condabuilder]# conda activate jupyter
(jupyter) [root@conda condabuilder]# python -VV
Python 3.10.9 | packaged by conda-forge | (main, Feb  2 2023, 20:20:04) [GCC 11.3.0]

From the results, we can see that the GCC version contained in Python's version info is not related to the system's GCC. The system's default Python (2.7.5) should have been compiled with the GCC version distributed with CentOS 7, so the version info show the same GCC version. But for user installed python, the GCC version info actually depends on what version of GCC is used for building and packging the python binary.