🌐
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
🌐
Tutorial for Linux
tutorialforlinux.com › step by step – gcc 11.2 centos 8/stream installation
Step by step - GCC 11.2 CentOS 8/Stream Installation • tutorialforlinux.com
May 25, 2022 - GNU/Linux CentOS 8/Stream Installing ... – Step by step Tutorial. And the GCC 11.2 for CentOS 8 is a Compilers Collection currently supporting C, C++, Objective-C, ......
🌐
GitHub
gist.github.com › nchaigne › ad06bc867f911a3c0d32939f1e930a11
Building GCC 9.2.0 on CentOS 7 · GitHub
That is correct. I did build gcc-11 from source as per instructions. But in the end I used devtoolset-11-* and things seems to work ...
🌐
Centos
lists.centos.org › hyperkitty › list › discuss@lists.centos.org › message › OLWN2OCWBQCNC3ZB2WVCVAM7TQT7RQ6A
Re: [CentOS] Package of GCC 12 on CentOS 7 - Discuss - lists.centos.org
Is there an rpm of GCC 12 (or at least higher than 9) available to download and install, or is it a case of downloading and build from the source yourself? That's what Software Collections is for. ... Specifically you need one of the devtoolset collections - it goes up to 11 which, unsurprisingly, provides gcc-11 on CentOS 7.
🌐
GitHub
github.com › microsoft › onnxruntime › issues › 12393
Build failure with gcc 11 on CentOS 7. · Issue #12393 · microsoft/onnxruntime
July 30, 2022 - Describe the bug This is specific to gcc-11 on CentOS 7 (devtoolset-11). Works on Debian 11 with gcc-10 and Ubuntu 18.04 with gcc-8. Seems to be a new regression on v1.12.0 as we were able to build v1.11 before. [1/8] ccache /opt/rh/devt...
Author   microsoft
Find elsewhere
🌐
Hiltmon
hiltmon.com › blog › 2015 › 08 › 09 › c-plus-plus-11-on-centos-6-dot-6
C++11 on CentOS 6.6 - Hiltmon
September 8, 2015 - We need to get the repo files for DevTools2, a Red Hat package that contains a supported C++11 compiler. As root, run the following command to retrieve the repo file: wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo · Then install the compiler and support tools: yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ Before you can compile C++11 code with the DevTools2 compiler, you need to enable it in a new shell: scl enable devtoolset-2 bash ·
🌐
Centos
buildlogs.centos.org › c7.1611.00 › gcc › 20161104121846 › 4.8.5-11.el7.x86_64
Index of /c7.1611.00/gcc/20161104121846/4.8.5-11.el7.x86_64
This server contains a mix of raw/unsigned packages and/or build logs It should be used mainly for testing purposes
🌐
JWillikers
jwillikers.com › build-gcc-from-source-on-centos-7
Build GCC From Source on CentOS 7 - JWillikers
October 28, 2020 - Rejoice! You now have an up-to-date version of the GCC compiler on your effectively ancient CentOS system.[1] Now, what are you waiting for? Start using std::span! 1. That’s right, CentOS 7 uses the pre-C++11 ABI.
🌐
Tenable
tenable.com › plugins › nessus › 155561
CentOS 8 : gcc-toolset-11-gcc (CESA-2021:4586)<!-- --> | Tenable®
November 18, 2021 - CPE: p-cpe:/a:centos:centos:gcc-toolset-11-gcc-gfortran, p-cpe:/a:centos:centos:gcc-toolset-11-libstdc++-docs, p-cpe:/a:centos:centos:gcc-toolset-11-libatomic-devel, p-cpe:/a:centos:centos:gcc-toolset-11-libgccjit, p-cpe:/a:centos:centos:gcc-toolset-11-libitm-devel, p-cpe:/a:centos:centos:gcc-toolset-11-libtsan-devel, p-cpe:/a:centos:centos:gcc-toolset-11-libasan-devel, p-cpe:/a:centos:centos:gcc-toolset-11-libgccjit-docs, cpe:/o:centos:centos:8, p-cpe:/a:centos:centos:gcc-toolset-11-gcc-c++, p-cpe:/a:centos:centos:gcc-toolset-11-gcc-gdb-plugin, p-cpe:/a:centos:centos:libasan6, p-cpe:/a:centos
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.

🌐
EdwardsLab
edwards.flinders.edu.au › c11-on-centos-6
C++11 on CentOS 6 | EdwardsLab
August 28, 2019 - Here is how to install C++11 on CentOS6 or CentOS7, and temporarily activate it in a shell. This does not change the default compiler and should cause less problems with your system (but that is not a money back guarantee … you are own your own if it does!) ... # gcc --version gcc (GCC) 4.8.5 ...
🌐
Centos
lists.centos.org › hyperkitty › list › discuss@lists.centos.org › thread › POTHJYRWJSSESJ3TWDHO76JIMAXZBYCS
Package of GCC 12 on CentOS 7 - Discuss - lists.centos.org
Is there an rpm of GCC 12 (or at least higher than 9) available to download and install, or is it a case of downloading and build from the source yourself?
🌐
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 ...
🌐
Linuxize
linuxize.com › home › gcc › how to install gcc compiler on centos 7
How to Install GCC Compiler on CentOS 7 | Linuxize
October 31, 2019 - We’ll explain how to install the distro stable version and the newer version of GCC available from the SCL repository. To add new repositories and install packages on your CentOS system, you must be logged in as root or user with sudo privileges .