linuxgccdevtoolset

Can not find required gcc version after devtoolset installation


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 try scl enable devtoolset-8 -- bash, it shows

Unable to open /etc/scl/conf/devtoolset-8!

Then I have checked in /etc/scl/conf/ where there is one file named 'devtoolset-9'. But I was expecting devtoolset-8.

If I run yum list installed | grep devtoolset, it shows packages related to devtoolset-8 and devtoolset-7. But I can not switch to gcc 7 or 8 because of that previous error. If I run scl enable devtoolset-9 -- bash, it does not change to the gcc version, stays at the default gcc. What may go wrong and how do I switch to gcc 7 or 8 in my case?


Solution

  • I ran into the same issue that you are facing and this is how I got it fixed:

    1. Just want to be careful, you need to exist the Terminal and open a fresh one to start. This way, you are not under any devtoolset's bash.
    2. Go to /opt/rh folder, run command ls -la to see if you have any devtoolset-* folder there. Let's say you have devtoolset-8, proceed step 2.
    3. Go to /etc/scl/prefixes folder, if you don't see devtoolset-8 file, you can create a new one as devtoolset-8, and type 1 line: /opt/rh, then save and quit that file.
    4. Once you are done, you can call: scl enable devtoolset-8 -- bash w/o any error. Good luck