I had this problem as well. I don't know why scl was failing to enable the environment, but I was able to get it to load with source /opt/rh/devtoolset-7/enable.

Answer from user561726 on serverfault.com
🌐
GitHub
github.com › openssl › openssl › issues › 7982
Build fails on centos7 with devtoolset-7 · Issue #7982 · openssl/openssl
April 1, 2019 - The build of openssl 1.1.0 (and also 1.1.1) fails when devtoolset-7 is installed and enabled. Building 1.1.0 on a "vanilla" centos7 works. Installed devtoolset like this: $ yum install -y centos-release-scl \ $ yum-config-manager --enabl...
Author   openssl
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
🌐
Posit Support
support.posit.co › hc › en-us › articles › 360006145413-RStudio-Workbench-RStudio-Server-Pro-with-devtoolset-enabled
Posit Workbench with devtoolset enabled – Posit Support
July 25, 2024 - cc1plus: error: unrecognized command line option "-std=c++11" or · fatal error: codecvt: No such file or directory · For example, on CentOS 7: yum install centos-release-scl · yum install devtoolset-9 · Execute: gcc --version · Enable devtoolset-10 with: source scl_source enable devtoolset-9 ·
🌐
GitHub
github.com › ceph › ceph › pull › 27183
rpm: s/devtoolset-7/devtoolset-8/ by tchaikov · Pull Request #27183 · ceph/ceph
+ . /opt/rh/devtoolset-7/enable /var/tmp/rpm-tmp.xvVVHw: line 30: /opt/rh/devtoolset-7/enable: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.xvVVHw (%build) Copy link · Contributor · Warning: end of file not at end of a line; newline inserted ·
Author   ceph
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
1319936 – sudo is broken after installing devtoolset
Red Hat Bugzilla – Bug 1319936 · This site requires JavaScript to be enabled to function correctly, please enable it · Privacy Contact FAQ Legal
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
1873882 – Should /opt/rh/devtoolset-9/enable add both 32 ...
Red Hat Bugzilla – Full Text Bug Listing · This site requires JavaScript to be enabled to function correctly, please enable it · Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla · Bug 1873882 · Privacy Contact FAQ Legal
Find elsewhere
🌐
LinuxQuestions.org
linuxquestions.org › questions › centos-111 › after-updates-configure-can't-find-devtoolset-gcc-4175533061
[SOLVED] after updates configure can't find devtoolset gcc
February 4, 2015 - After allowing updates on centos 6.5, hp printer no longer works. The hplip configure returns the following: [root@q hplip-3.14.10]# ./configure
🌐
Red Hat
access.redhat.com › solutions › 5114411
httpd24-httpd.service failed /opt/rh/httpd24/enable: No such file or directory - Red Hat Customer Portal
June 14, 2024 - RHSCL httpd24 is failed to start with the following error, How to fix it? [root@rhel7 httpd24]# systemctl start httpd24-httpd.service Job for httpd24-httpd.service failed because the control process exited with error code. See "systemctl status httpd24-httpd.service" and "journalctl -xe" for details.
🌐
GitHub
github.com › NVIDIA › apex › issues › 1656
Help me, I'm dying soon,error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed with exit code 1 error: subprocess-exited-with-error · Issue #1656 · NVIDIA/apex
May 5, 2023 - I also upgraded gcc: yum install centos-release-scl yum install devtoolset-7* #激活对应的devtoolset,所以你可以一次安装多个版本的devtoolset,需要的时候用下面这条命令切换到对应的版本 scl enable devtoolset-8 bash
Author   NVIDIA
🌐
Red Hat
docs.redhat.com › en-us › documentation › red_hat_developer_toolset › 12 › pdf › user_guide › Red_Hat_Developer_Toolset-12-User_Guide-en-US.pdf pdf
Red Hat Developer Toolset 12 User Guide
specify the option adding the library after the options specifying the object files: $ scl enable devtoolset-12 'gcc objfile.o -lsomelib' Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of ... Enterprise Linux 7 provides in-depth information about GCC.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360004312319-enable-scl-devtoolset
enable scl devtoolset – IDEs Support (IntelliJ Platform) | JetBrains
C Compiler: /opt/rh/devtoolset-7/root/usr/bin/gcc · C++ Compiler: /opt/rh/devtoolset-7/root/usr/bin/g++ Instead of the default C and C++ compiler (same for the Debugger). You can use: "locate gcc | grep devtoolset" if you want to quickly find out where your devtoolset install is.
🌐
Materials Science Community Discourse
matsci.org › lammps › lammps installation
Problem with gcc during install - LAMMPS Installation - Materials Science Community Discourse
September 20, 2022 - Dear all, I wish to install LAMMPS version 3Aug2022 using cmake after updating gcc version 4.8.5 to 11.1 on Centos 7 workstation. I used gcc install from devtoolset-11 as root superuser. gcc 11 was thus installed for all workstation users. as user (not root), my cmake command and output were: cmake -C …/cmake/presets/most.cmake -C …/cmake/presets/kokkos-openmp.cmake -D KOKKOS=yes -D Kokkos_ARCH_SKX=yes -D Kokkos_ENABLE_OPENMP=yes -D BUILD_OMP=yes …/cmake loading initial cache file …/cmak...
🌐
Centos
cbs.centos.org › koji › fileinfo
/opt/rh/devtoolset-3/enable | File Info | CentOS Community Build Service
Main Site Links: · Summary · Packages · Builds · Tasks · Build Targets · Users · Hosts · Reports · Search
🌐
Stack Overflow
stackoverflow.com › questions › tagged › devtoolset
Highest scored 'devtoolset' questions - Stack Overflow
July 6, 2023 - I can't find any documentation whatsoever on how to target 32-bit with Red Hat Developer Toolset (version 9.0 in this case running on CentOS 7). The release notes mention: Generation and ... ... Is there an appropriate way to enable devtoolset or any of the rh tools in the fish shell on startup? Normally in Zsh (~/.zshrc) or Bash (~/.bashrc) you would add lines similar to: source /opt/rh/...
🌐
GitHub
github.com › open-webrtc-toolkit › owt-server › issues › 1310
/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lwebrtc · Issue #1310 · open-webrtc-toolkit/owt-server
February 23, 2023 - make: Entering directory /usr/owt-server-master/source/agent/webrtc/rtcFrame/build' SOLINK(target) Release/obj.target/rtcadapter.so /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lwebrtc collect2: error: ld returned 1 exit status make: *** [Release/obj.target/rtcadapter.so] Error 1 make: Leaving directory /usr/owt-server-master/source/agent/webrtc/rtcFrame/build' gyp ERR!
Author   open-webrtc-toolkit