AnswerBun.com

Uninstall gcc-5.4.0 to run gcc-4.8 as default

Ask Ubuntu Asked by Claudio Nahmad on August 9, 2020

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

3 Answers

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 /usr/local/bin/.

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

cd /usr/bin
sudo rm gcc
sudo ln -s gcc-4.8 gcc

now try

gcc --version

And see if you got the desired result

Answered by amanusk on August 9, 2020

Add your own answers!

Related Questions

FTP cannot change directory

2  Asked on February 8, 2021 by ravenspoint

 

Adjust brightness with xrandr and cron job

5  Asked on February 8, 2021 by piney

         

Where is /var/log/messages?

2  Asked on February 8, 2021 by john-ianadus

   

Where to install json-c

1  Asked on February 7, 2021 by serenity

     

Ubuntu 20.04 zfs grub rollback snapshots

1  Asked on February 6, 2021 by catalyph

         

How to control fan speed?

7  Asked on February 6, 2021 by grizwako

   

Problem connecting to xrdp (windows 10 ->ubuntu 14.04)

1  Asked on February 6, 2021 by m-questioner

       

Change description of OS

1  Asked on February 6, 2021 by jorge-caro-almohalla

   

How do I Fix Grub Error 15 on New Dual Boot Install

2  Asked on February 5, 2021 by garth

   

Grub menu not showing after recent Upgrade

1  Asked on February 4, 2021 by eduardo-baitello

         

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir