bashdevtoolsetgcc8

How to disable devtoolset-8?


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 strip)"'

After completing the assembly, I need to "turn off" gcc-8.

How can I do this by means of bash?


Solution

  • You don't need to turn anything "off" after the above command, all that it does is prints paths of the main devtoolset executables, e.g.

    %__ld /opt/rh/devtoolset-8/root/usr/bin/ld
    %__nm /opt/rh/devtoolset-8/root/usr/bin/nm
    %__objcopy /opt/rh/devtoolset-8/root/usr/bin/objcopy
    %__objdump /opt/rh/devtoolset-8/root/usr/bin/objdump
    %__strip /opt/rh/devtoolset-8/root/usr/bin/strip
    

    When you run a most used scl enable devtoolset-8 bash command, it is invokes a new bash instance where you have an additional path in your $PATH enviroment variable making all the development tools now run from the new location:

    [user@hostname ~]$ echo $PATH
    /usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    [user@hostname ~]$ scl enable devtoolset-8 bash
    [user@hostname ~]$ echo $PATH
    /opt/rh/devtoolset-8/root/usr/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    [user@hostname ~]$
    

    All you need to "turn off" the devtoolset is to exit this bash instance:

    [user@hostname ~]$ exit
    exit
    [user@hostname ~]$ echo $PATH
    /usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    [user@hostname ~]$