Solve it by using echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile

Answer from GOGO on Stack Overflow
🌐
Softwarecollections
softwarecollections.org › en › scls › rhscl › devtoolset-8
Developer Toolset 8 — Software Collections
Install the collection: $ sudo yum install devtoolset-8 # 3. Start using software collections: $ scl enable devtoolset-8 bash
Discussions

linux - How to permanently enable newer version of software installed from SCL repo? - Unix & Linux Stack Exchange
Right now, when I ssh into my server ... command scl enable devtoolset-1.1 bash · I tried adding it to ~/.bashrc and simply pasting it on the very last line, without success. ... In your ~/.bashrc or ~/.bash_profile Simply source the "enable" script provided with the devtoolset. For example, with the Devtoolset 2, the command is: ... This was applicable on centos 6.8... More on unix.stackexchange.com
🌐 unix.stackexchange.com
December 25, 2014
linux - How to install gcc8 using devtoolset-8-gcc - Stack Overflow
I am using CentOS Linux release 7.3.1611 which has gcc 4.8.5 20150623 installed. I am looking for a way to install a newer version of gcc, specially 8.1. I found the following site on how to inst... More on stackoverflow.com
🌐 stackoverflow.com
bash - How to disable devtoolset-8? - Stack Overflow
I have a bash script that executes the command scl enable devtoolset-8 'echo -e "%__ld $(which ld)\n%__nm $(which nm)\n%__objcopy $(which objcopy)\n%__objdump $(which objdump)\n%__strip $(which More on stackoverflow.com
🌐 stackoverflow.com
October 20, 2020
Installing devtoolset-X
$ sudo dnf search toolset Last metadata expiration check: 2:26:13 ago on Mon 15 Nov 2021 05:10:30 AM EST. ============================================= Name & Summary Matched: toolset ==== gcc-toolset-10.x86_64 : Package that installs gcc-toolset-10 gcc-toolset-10-runtime.x86_64 : Package that handles gcc-toolset-10 Software Collection. gcc-toolset-11.x86_64 : Package that installs gcc-toolset-11 gcc-toolset-11-runtime.x86_64 : Package that handles gcc-toolset-11 Software Collection. gcc-toolset-9.x86_64 : Package that installs gcc-toolset-9 gcc-toolset-9-runtime.x86_64 : Package that handles gcc-toolset-9 Software Collection. So do dnf-install gcc-toolset-X, then scl enable devtoolset-X bash More on reddit.com
🌐 r/AlmaLinux
1
7
November 14, 2021
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360004312319-enable-scl-devtoolset
enable scl devtoolset – IDEs Support (IntelliJ Platform) | JetBrains
When you do scl enable devtoolset, it is simply pointing towards what devtoolset provides. ... And you will see that the g++ version has changed after enabling devtoolset. ... actually just a replacing the paths of the toolchain with a specific ...
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 [ 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 [ {#_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
Find elsewhere
🌐
Stanford
confluence.slac.stanford.edu › display › SCSPub › Red+Hat+Software+Collections
Red Hat Software Collections - Scientific Computing Services Public - SLAC Confluence
July 5, 2024 - ksa@rhel6-64 $ scl enable devtoolset-8 'gcc --version' | head -1 gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)
🌐
University of Edinburgh
computing.help.inf.ed.ac.uk › scl
Software Collections | Documentation
To activate the devtoolset you ... You can run any application or script you wish, it does not need to be a shell. The scl enable command is used to enable the specified software collection....
🌐
Princeton CS Guide
csguide.cs.princeton.edu › software › scl
Software Collections (SCL) | Department of Computer Science Computing Guide
$ scl --list devtoolset-3 devtoolset-8 httpd24 maven30 mysql55 rh-git29 rh-java-common rh-nodejs10 rh-php56 rh-python34 rh-python36 · In order to use the package, you must first 'enable' its use and run a program with the package enabled. Bash starts a new shell with all variables set.
🌐
Stack Overflow
stackoverflow.com › questions › 43880358 › scl-enable-not-setting-path-with-bash
software collections - 'scl enable' not setting PATH with bash - Stack Overflow
I'm trying to use software collections on CentOS 6.8 server, but it won't set the environment variable PATH corectly if the command passed is "bash", but "tcsh" works... (however we don't use tcsh on this machine) ... $ scl --list devtoolset-4 python27 rh-java-common rh-perl524 rh-python35 $ which python /usr/bin/python $ python --version Python 2.6.6 $ scl enable python27 bash $ which python /usr/bin/python $ python --version Python 2.6.6 $ cat /opt/rh/python27/enable export PATH=/opt/rh/python27/root/usr/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64${LD_LIBRARY_
🌐
Ucsf
wynton.ucsf.edu › hpc › software › scl.html
Software Collections (SCL)
If you work interactively on one of the development nodes, you can also launch a new shell (typically Bash) with one or more SCLs enabled:
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Highest scored 'devtoolset' questions - Stack Overflow
July 6, 2023 - As recommanded by RH,when i want ... that executes the command scl enable devtoolset-8 'echo -e "%__ld $(which ld)\n%__nm $(which nm)\n%__objcopy $(which objcopy)\n%__objdump ......