1

I have gcc 4.6.2 installed (installed from tar source) in my ubuntu server 10.10 64 bit, I have also installed gcc 4.4.5. I want to uninstall gcc 4.6.2 and make my old gcc 4.4.5 default. How can I do this?

1

3 Answers 3

1

Don't need to uninstall 4.6.2. If you have installed it from the repositories and also have gcc 4.5 installed, you can do:

sudo update-alternatives --config gcc

which will allow you to choose what is your default compiler. Uninstalling gcc 4.6.2 could impact other packages.

0

First, don't change the default compiler used by your OS super-user. The packaging guys have carefully tested that everything works with 4.6, and if you change that you risk destabilizing your system, and that could end badly.

What you can do is adjust the default compiler for yourself only by simply altering the PATH variable in your shell setup.

So, simply add this:

PATH=/path/to/your/gcc/bin:$PATH

to your ~/.profile or ~/.bash_profile or ~/.bashrc or whatever is most appropriate to you. (Or just add it to all of them to be on the safe side.

0

In GCC 5.1.0, the best method so far is to install it somewhere else with DESTDIR and then use that to decide which files were generated, as mentioned at: https://stackoverflow.com/a/25304014/895245

Although there is no top-level uninstall target, some directories do have it, in particular gcc, so you can do:

cd build/gcc
sudo make uninstall

This does not remove everything that was installed, but it removes major executables like gcc, g++, cpp... contained in that directory, so it might be enough.

Another dirty workaround:

sudo find /usr/local/bin -maxdepth 1 -mtime -1 -delete

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .