I am using Ubuntu 14.04. Recently I decided to install gcc-5.4.0 (from source, i.e. i downloaded a tar ball and followed instructions to install) since it was needed to run CAMB and CosmoMC.
However, I am in need of using a new program: CosmoSIS (https://bitbucket.org/joezuntz/cosmosis/wiki/Manual%20Install), this code requires gcc-4.8 to run.
Whenever i try to install CosmoSIS, the code crashes because when it is searching for gcc-4.8 in /usr/local/bin it conflicts with gcc-5.4 which is installed in the same directory (i am new to this, i’m guessing i made a mistake by installing 5.4 in the same directory in which 4.8 is installed)
I’m looking for help on uninstalling gcc-5.4 since my priority is running CosmoSIS and gcc-4.8 is needed. I know there is no “uninstall” command for source-installed programs, but i need help on this: How can i uninstall a source-installed program?
Thank you in advance
Indeed, there is no "uninstall" command when installing from source, unless the developer has decided to put one in. (i.e., it's not impossible for a developer to create a script that undoes everything)
Your only option is to go into
/usr/local/bin/ and remove each file yourself. But which ones to remove?
One solution is to reinstall 5.4, but specify a new directory that isn't
/usr/local/bin/. This will give you a list of files that 5.4 installed. Then, using the list of files, go into
/usr/local/bin/ and remove them manually. Note that it probably installed libraries and documentation into other directories, so to remove it completely, you will have to do more than just
An alternative is to not do an uninstallation and just install gcc 4-8 on top of 5.4. It's the same program, but just a different version. So
gcc version 4.8 will overwrite 5.4. The "downside" is that you might have 5.4 files lying around, but they will just occupy (relatively little) space. It'll solve your problem and you can move ahead with what you want to do.
Of the two options, I'd pick the second one. The 5.4 files that remain won't affect your system. Relative to images, video, or almost any type of data, the space they occupy is fairly little (i.e., compiler, libraries, documentation is probably small). In the future, you should install it in another directory and add symbolic links manually.
update-alternatives would do that for you if it's a package installed compiler; but for a compiler installed from source, that isn't an option.
(Aside: Ubuntu 14.04 has reached end of life, I think. You might consider upgrading some day... If so, then what
/usr/local/bin/ looks like won't matter anymore!)
Answered by Ray on August 9, 2020
I advise to use
update-alternatives command as described in the answer How to choose the default gcc and g++ version?
Answered by mboyar on August 9, 2020
Just create a symbolic link to gcc-4.8
sudo rm gcc
sudo ln -s gcc-4.8 gcc
And see if you got the desired result
Answered by amanusk on August 9, 2020
Get help from others!