RHEL 6 SCL script not sourcing for normal user

520 views Asked by At

I'm using devtoolset-2 on a rhel 6.9 installation so I can use the gcc 4.8 version that devtoolset-2 offers. On a previous rhel 6.2 installation (on a VM) I was able to enable devtoolset-2's gcc by adding a script in /etc/profile.d/ to source devtoolset-2's enable script:

$ cat /etc/profile.d/devtoolset2.sh
#!/bin/bash
source scl_source enable devtoolset-2

That worked great, giving me access to gcc 4.8 for any terminal window I opened.

Now on this new 6.9 install (on real hardware) I've tried the same script in the same location, but it never sources. New terminal windows always default to the system's gcc 4.4. I can, however, manually source the enable script and it does work:

$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)

$ source scl_source enable devtoolset-2
$ gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

After googling I tried sourcing the script with several different commands as well:

. /opt/rh/devtoolset-2/enable
source /opt/rh/devtoolset-2/enable
... etc.

I want this setting to apply to all user's terminals, but just to be complete I tried sourcing it from both my .bashrc and .bash_profile scripts and neither worked for my user.

One last thing I noticed is that if I logged in as root, instead of a normal user, the script in /etc/profile.d/ did source devtoolset-2 just fine.

Any ideas why it would source automatically for root, but not any other users?

0

There are 0 answers