🌐
Reddit
reddit.com › r/cpp › devtoolset is a game changer for c++ development on linux
r/cpp on Reddit: Devtoolset is a game changer for C++ development on Linux
March 23, 2018 -

On Linux the dependency on system compilers have always been frustrating since it means your stuck with ancient GCC versions. But I must say I'm very impressed with devtoolset for RHEL/CentOS, it means you can use gcc-7 on old crappy RHEL6 that so many large companies insist on using. And you can ship the resulting binaries and it will run on plain vanilla RHEL installations!

Top answer
1 of 5
12

what is devtoolset ?

2 of 5
6

devtoolset-7 also provides newer versions of lots of supporting debug and performance tools like gdb.

They (RH or Centos) also provide containerised versions of the build tools and the performance tools.

There is also a tech preview of the llvm-toolset, admittedly at clang v4 but still able to build those compatible binaries.

Note that you want to build using a host that is lower or same version as your minimum target version.

e.g. toolset-7 on host centos v6.7 will create bins compatible with 6.7, 6.9 and 7.x If your host is say centos 7.2 toolset-7 builds are only guaranteed to be compatible with v7.2+ targets.

Redhat's documentation is really good (and you can even get a free developer login to access more resources).

Also note that Centos provides similar options to RHEL.

The only downside is I don't think you can use the new ABI variant of CXX LIB as the ABI isn't compatible with older compilers like the default Centos gcc 4

Not really a problem as you can still use the C++11/14/17 features, just a few items are incompatible (such as list::size() still being O(n) and not const time, or strings still being COW)

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ (Lots of other tools/langs etc there too like Go,Rust,Python3 and lots of database updated versions etc.)

Not sure if you need to have a developer account, but an example of the documentation: https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/7/html/7.0_release_notes/dts7.0_release

🌐
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 ...
🌐
Rocky Linux Forum
forums.rockylinux.org › rocky linux help & support
How to install devtoolset-11-gcc-c++ \ - Rocky Linux Help & Support - Rocky Linux Forum
January 3, 2025 - Hello, Im having a hard time installing devtoolset-11-gcc-c++ on Rocky Linux 9. Can someone help me install it? thanks
🌐
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 - devtoolset-11 gcc-11 · Previous Thread Next Thread · Loading... Page 1 of 2 · Previous Thread Next Thread · Loading... (You must log in or sign up to reply here.) Show Ignored Content · Page 1 of 2 · Donate · Donate · Centmin Mod Nginx auto installer installs Nginx (ngx_pagespeed + SPDY), PHP-FPM & MariaDB on CentOS.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Highest scored 'devtoolset' questions - Stack Overflow
January 12, 2022 - I would like to use devtoolset-7 to build a C++11 application on CentOS 7.
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 10 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 10 | Red Hat Documentation
Consider the employee file from Example 11.1, “Using memstomp”. Run the strace utility on this executable file and trace only the mmap and munmap system calls: $ scl enable devtoolset-10 'strace -e mmap,munmap ./employee' mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, ...
🌐
Developer Community
developercommunity.visualstudio.com › t › linux-supportguide-for-redhat-devtoolset › 1617987
Linux Support/Guide for RedHat devtoolset
Skip to main content · Microsoft · Visual Studio · Sign in · You need to enable JavaScript to run this app · Sorry this browser is no longer supported · Please use any other modern browser like 'Microsoft Edge'
🌐
Red Hat
docs.redhat.com › ja › documentation › red_hat_developer_toolset › 11 › pdf › user_guide › red_hat_developer_toolset-11-user_guide-ja-jp.pdf pdf
Red Hat Developer Toolset 11 ユーザーガイド Red Hat Developer Toolset のインストールと使用
Red Hat Developer Toolset には GCC 11.2 が同梱されています。このバージョンは、Red Hat · Enterprise Linux に含まれるバージョンよりも新しいもので、バグ修正および機能強化が数多く追加さ ... Red Hat Developer Toolset では、GNU C コンパイラーは devtoolset-11-gcc パッケージで提供さ
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Recently Active 'devtoolset' Questions - Stack Overflow
On an Amazon Linux 2 Docker image, ... part of "devtoolset-8" (https://www.softwarecollections.org/... ... I am using Centos 7 with kernel 3.10.0 My current gcc version is 4.8.5 and I am trying to install gcc 7 or later versions. I have followed instructions from How to install GCC/G++ 8 on CentOS When I ... ... I have a Docker image that is used for running tests in Jenkins and Bamboo. I need to upgrade the version of g++ used (to something with C++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
🌐
Red Hat
docs.redhat.com › en › documentation › red_hat_developer_toolset › 12 › html-single › user_guide › index
User Guide | Red Hat Developer Toolset | 12 | Red Hat Documentation
Red Hat Developer Toolset is distributed with GDB 11.2. This version is more recent than the version included in Red Hat Enterprise Linux and the previous release of Red Hat Developer Toolset and provides some enhancements and numerous bug fixes. In Red Hat Developer Toolset, the GNU Debugger ...
🌐
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.
🌐
Tenable
tenable.com › plugins › nessus › 155371
RHEL 7 : devtoolset-11-gcc (RHSA-2021:4669)<!-- --> | Tenable®
November 1, 2021 - The remote Redhat Enterprise Linux ... languages, including C, C++, and Fortran. The devtoolset-11-gcc packages provide the Red Hat Developer Toolset version of GCC, as well as related libraries....