Uninstall gcc from source

2

For fun, I compiled and installed gcc 4.7.2 in ~/build, which contains bin, doc, lib, include, man, share, et al. directories, all of which are added to the appropriate environment variables.

Now I want to remove it, so it can stop shadowing my v4.4.7 /usr/bin/gcc with all its associated libraries and whatnot (whatever they may be), but, of course, the GCC make files offer no uninstall target, and find ~/bin -iname "\*gcc*" turns up quite a bit.

Is my only option to set the prefix to some temporary directory, run the installation again, then use than new set of files as a guide for deleting the old ones? Or is there a better way?

This is on Springdale Linux 6.4 (Pisa), kernel 2.6.32-358.11.1.el6.x86_64, and I do not have root access.

tsbertalan

Posted 2013-10-22T16:24:44.503

Reputation: 325

Did you run a make install? From your question it sounds like everything is in subdirectories of ~/build and deleting that dir is all you need. – terdon – 2013-10-22T16:28:12.657

That is true (the compiler executable for instance is at ~/build/bin/gcc) but, since I don't have root access on this machine, I use this directory extensively to install software for my user. Clearly I should have put the GCC install in its own subdirectory to begin with, but I did not. – tsbertalan – 2013-10-23T17:07:16.150

Answers

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.

Ciro Santilli 新疆改造中心法轮功六四事件

Posted 2013-10-22T16:24:44.503

Reputation: 5 621