Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-10-2009, 04:43 AM   #1
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
Delete files from program built from source

I have built a program from source and now want to delete all the files that have anything to do with this program... and start over again.

When an .rpm is installed, one can delete all the files quite easily with the rpm-command.

How to delete a program when it was build from source (make, make install) ?
Old 07-10-2009, 04:59 AM   #2
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,453
Blog Entries: 55

Rep: Reputation: Disabled
I think with some you can run make uninstall.
Old 07-10-2009, 05:00 AM   #3
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
make uninstall
This is why it's a good idea to preserve the source tree, so you can make uninstall when needed on it. If you deleted it after installing, you will need to re-fetch, configure it with the same options (particularly those involving paths like --prefix), then make uninstall.

This is for a standard autotools based build system. Not all packages will follow the same pattern of course. You should always check the READMEs and docs contained within the package, or in the home site.
Old 07-10-2009, 05:33 AM   #4
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Try using the checkinstall program. If you run it instead of "make install", it will wrap the install files up into a (rpm|deb|tgz) package and optionally install it for you using your default package manager. This integrates it with your package system so you can uninstall it like any other package.

You won't need to keep your source directory around if you use it either (though it may still be a good idea to hang on to it).
Old 07-10-2009, 05:39 AM   #5
LQ Guru
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285Reputation: 1285
This is why on an RPM based system you should make rpms out of anything you want to install. Don't count on 'make uninstall' being there, because it usually is NOT there. You can also use 'checkinstall' or paco to log packages that are installed so you can delete them later.
Old 07-10-2009, 05:57 AM   #6
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
The "source" of the Problem.


I've been where you are, and I really feel the need to comment. I've learned this lesson the "hard way" about compiling from source, and I only hope it's not too late for you.

I've seen my share of software projects that didn't define "uninstall" in their Makefile, which leaves "The Big ReInstall" as the only cleanup option after a year or so compiling from source without specifying certain options.

For future reference, when running "./configure --help" check to see if you can specify a "--prefix=". Typically this is what I do;

./configure --prefix=/usr/local/package-1.2.3-ddmmmyy

Where "package" is the package name, "1.2.3" is the version number, and "ddmmmyy" is the day, month, and year that the version was released (so I know when to go looking for new releases).

Once I build the package, if I have to call the binaries manually, I'll create a link like so;

ln -s /usr/local/package-1.2.3-ddmmmyy /usr/local/package

That way, I can put a simple directory in the global $PATH. It also makes upgrades easier, I just have to build a new version with a new "--prefix=" string, then all that's left is changing the symbolic link.

This makes roll-backs and general cleanup easier, for those of us who work in an environment where we have to consider Production vs. Development areas.
Plus I don't have to keep the exploded source tree anywhere!
Old 07-10-2009, 06:00 AM   #7
Registered: Jun 2009
Posts: 101

Rep: Reputation: 19
The 'make uninstall' is not necessarily available. As a matter of fact, about anything in makefiles is rather optional and depends on the mood and concept of the programmer.

If the source building procedure uses a standard approach by having a proper configure file, then rather set the installation target location with the prefix option to some distinct directory. In that case the make install command will install everything in that location and you will always know what belongs to that package. Something like:
$ ./configure --prefix=/opt/my-new-application-directory

Once the /opt directory was meant to used like that, by having a distinct directory for each application, but people did find it difficult to add each of those directories to their $PATH variable.


Last edited by jeromeNP7; 09-04-2009 at 09:56 PM.
Old 07-10-2009, 06:42 AM   #8
Registered: May 2001
Posts: 29,332
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
...and while this is not practical if one doesn't know install locations or regards it as too time-consuming, still the RPM database can help out because files in "the usual" locations that are not recognised by RPM will return the specific "... is not owned by any package" message. So if you for instance know that it was configured and installed with a default --prefix=/usr/local, then running 'find /usr/local -print0 | xargs -0 -iX rpm -qf 'X'|awk '/owned/ {print $2}'' will show all files not owned by a package. This does not mean all files listed are from that particular installation but comparing timestamps can help narrow down suspects more: 'find /usr/local/bin -print0 | xargs -0 -iX rpm -qf 'X'|awk '/owned/ {print $2}'|xargs -iX stat -c "%Z %X" 'X'|sort -gk1'.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
uninstalling something built from source lauram93 Linux - Software 1 10-18-2007 01:31 PM
i want to run python program on new built lfs shankara Linux From Scratch 1 02-03-2006 03:42 PM
Old YaST source files - can I delete Suse 9l1 harry_fine Linux - Distributions 0 09-10-2004 02:12 PM
Can I delete source files? downinthemine Linux - Software 1 01-09-2004 08:54 AM
How to delete the destination files while the source files deleted in cp -u ? myunicom Linux - General 4 09-26-2003 02:13 PM

All times are GMT -5. The time now is 10:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration