I'm using debian to do most of my coding work, and I was doing a homework project that required a certain version of gcc to compile the program I was working on.

I downloaded the gcc source and compiled/installed it, but forgot to change any options, so I think it installed it to the default location, which in my case was /usr/local/bin/gcc. I wasn't really planning ahead when I did this, and when I realized I was done with the version of gcc for my homework, I didn't know how to remove it. Upon googling, I realized that this wasn't really possible, unless I used checkinstall which I didnt. Now however, because /usr/local/bin is ahead in my path, it uses my newer version of gcc to compile by default which causes problems when I try to use gdb to debug those versions of applications. I'm also worried that this will cause unwanted behavior in other applications that can screw things up.

Note: I can't just reorganize my path, because there are applications in /usr/local/bin that I want that override ones in /usr/bin

So my question is this: How do you manage self-compiled applications with packaged ones from repositories? What I mean is, what is the correct way of going about this, so that they don't conflict and one can safely be removed without screwing anything up? In terms of mixing them, how would I do something like using a self-compiled version of an application as a dependency for a packaged version? I don't think debian will automatically recognize that if I install gdb or something, that my local version of gcc will meet the criteria.

Also as a side-note: Where the heck do you install compiled applications? /usr/local/bin? /opt? /home/user/bin? /own_directory?

My apologizes if I wrote this badly or anything, I can clarify more if needed.


You could possibly get a list of the files that were installed when you compiled gcc by using make's -n or --dry-run option - e.g. running make -n install in the gcc source directory, and redirecting output to a file.

With a bit of post-processing (e.g. with sed), that should give you a list of files that you can delete - but be careful, sanity-check the list before committing to deleting them.

Not the answer you're looking for? Browse other questions tagged or ask your own question.