Can not find required gcc version after devtoolset installation

3.8k views Asked by At

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?

3

There are 3 answers

0
P.A. On BEST ANSWER

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
1
Steven Cao On

just only runing 'yum install devtoolset-8-gcc devtoolset-8-gcc-c++' is not working for me too. i tried to run 'yum install devtoolset-8 -y, and it is working fine.

0
zzzhhh On

I am using CentOS 7.9 and I encountered the same problem after following instructions here to install and run gcc 11. I tried launching different versions of gcc and found only devtoolset-9 works, which corresponds to the file devtoolset-9 in /etc/scl/conf/ folder. So I copied devtoolset-9 to devtoolset-11 in the same folder, and gcc 11 gets working.