Sample Header Ad - 728x90

How to change gcc version without root on CentOS 7

0 votes
1 answer
1908 views
I have access to a cluster with CentOS 7, which has gcc installed. Unfortunately, gcc version is pretty old (4.8), and is reported incompatible by some of the Python packages I am using, requiring version >5.0. However, since I do not have root privilege, I cannot easily install/delete anything there. I have followed some answers from stack exchange, installing the gcc 8.4 from source code. The make install seem to be successful. Then, I have followed the accepted answer to one question here (https://unix.stackexchange.com/questions/22263/how-to-set-the-default-gcc-version-for-only-one-user) to change the default. However, it does not work for me. 1. The gcc 8.4 is located at $HOME/gcc_8_4 with a (seemingly properly working) symlink $HOME/bin/gcc. 2. The gcc 4.8 is located at /usr/local/bin. 3. $HOME/bin comes **before** /usr/local/bin in the PATH, as written in the mentioned answer. 4. If I call ./gcc --version from $HOME/bin/gcc/bin directory, I get the version 8.4. If I call it as gcc --version from any location, I still get 4.8. So, has something changed since that answer was posted? Why the 4.8 version is taken as a default one despite it coming after 8.4 version in the PATH? Is there any way to fix that?
Asked by Valeria (101 rep)
Apr 5, 2021, 10:31 PM
Last activity: Jun 28, 2025, 01:00 PM