LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-10-2009, 03:43 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 690

Rep: Reputation: 34
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, 03:59 AM   #2
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

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

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Code:
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, 04:33 AM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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, 04:39 AM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
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, 04:57 AM   #6
xeleema
Member
 
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: 988
Blog Entries: 4

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

Greetingz!

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, 05:00 AM   #7
jeromeNP7
Member
 
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.

Linux

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

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...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'.
 
  


Reply



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 12:31 PM
i want to run python program on new built lfs shankara Linux From Scratch 1 02-03-2006 02:42 PM
Old YaST source files - can I delete Suse 9l1 harry_fine Linux - Distributions 0 09-10-2004 01:12 PM
Can I delete source files? downinthemine Linux - Software 1 01-09-2004 07:54 AM
How to delete the destination files while the source files deleted in cp -u ? myunicom Linux - General 4 09-26-2003 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:42 AM.

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