How to remove a package I compiled and installed?
I downloaded a program: units-1.74 from:
http://www.ee.surrey.ac.uk/Teaching/Unix/unix7.html I configured and compiled the program. After that I ran Code:
make install Quote:
Code:
makepkg units-1-i686-1js.tgz which I installed in /usr/local: Code:
ROOT=/usr/local installpkg units-1-i686-1js.tgz Quote:
Quote:
|
Wow. You kinda made a mess of things.
Issue #1: `makepkg` should be issued from the top level of your staging directory. If you want a file named 'foo' to go into /usr/bin, then (for example) `mkdir -p /tmp/staging/usr/bin ; cp foo /tmp/staging/usr/bin/foo` and run makepkg from /tmp/staging. It looks like you ran makepkg from the usr subdirectory of your staging area. Issue #2: The $ROOT variable does not do what you think it does for installpkg. You only pass $ROOT to installpkg when you want to install the package with somewhere other than / being treated as the root filesystem (like if you're booted up from the install media, and have all your disks mounted under /mnt, you'd use `ROOT=/mnt installpkg foo.tgz`. Doing what you did likely resulted in ugly things like /usr/local/var/log/packages/ being created. Issue #3: Do not install files into the production filesystem when you're making a package. According to your post you did a plain `make install` which is why you have the package's files present at all. Most (but not all) GNU autoconf-generated packages recognize the DESTDIR variable, which is another way of changing the root of the filesystem for what the Makefile is about to do. Next time, create /tmp/staging for use as the root of your staging filesystem (also called the "staging root") and then do a `make DESTDIR=/tmp/staging install`. This will result in things like /tmp/staging/usr/bin/units being created. You can then cd into /tmp/staging and check things out, fix permissions, deploy any custom install/doinst.sh scripts, spellcheck your new install/slack-desc file and so on, and then run makepkg. Hint: If you don't know if a Makefile respects DESTDIR, open the thing in a text editor and search for it, or grep for it. If it doesn't, there's likely some other variable (or variables) you can use that will do the same thing. |
Here is where you really went wrong...
Quote:
Maybe if you use ROOT=/usr/local when you removepkg it will work. If nothing else you know where the files are so you can remove them manually. If you can't remove the entry from the package db manually you could always upgrade the package with a proper one. Before makepkg you should have moved all folders (except install) under "usr" or "usr/local" if that is really your preference. I think the program you are trying to compile is the same one found at http://www.gnu.org/software/units/units.html. If so, you can simply use the SlackBuild to automate the build process for this program. You can find the SlackBuild at http://slackbuilds.org/repository/12.0/academic/units/. After you get it take a look at the build script. It will show you a great method for making a good package. Also, read this tutorial about making a Slackare build script and package. |
If i were you, i'd give src2pkg a try. it will build your package for you.
|
Naturally I'll second the vote to use src2pkg. To get rid of the original you may need to remove each file by hand, or you could remove them with 'make uninstall' if you haven't moved or removed the original sources. If you have moced them or removed them you could start again and configure the sources the same way you did at first, but after configuring, instead of running 'make install' run 'make uninstall'. You'll still have to clean up the other files which you created -the slack-desc, etc. As stated by others, packaged software should not be installed to /usr/local.
|
If there's a Slackbuild script available on Slackbuilds.org, it would be preferable to src2pkg.
|
Thanks for all the help. I got the program built and installed; and am able to remove it. I wasn't able to use DESTDIR, but used:
make prefix=/tmp/build/usr install. what is the problem with using /usr/local? I thought installing there would help me to keep track of programs I installed outside of the Slackware repository. Does it matter if I build the program as root or a normal user; build in /home/joe or in / ? |
If you are not making a package of the program, then /usr/local is indeed the correct place to put it. You can compile it as a normal user but install it as root. If you build it with a prefix to install in your users $HOME you could also install it as a normal user. When you configure, compile and install the program using --prefix=/usr/local, then the program will be installed as:
/usr/local/bin/units The real disadvantage to installing software manually is that you need the configured sources in place in order to be able to run 'make uninstall' to remove the software. Not much of a problem if it only installs a few files, but if it installs many then you may want some way to easily and dependably remove them. hence, the need for 'make uninstall'. If you did this: make prefix=/tmp/build/usr install Then you have the program installed to /tmp/build/usr/bin/units which is not a very good place to install software. It isn't in anyones' path so you can't run it without specifying the full path: /tmp/build/usr/bin/units Now, if you want to make a *package* of the program so that it can be properly installed and run, you could create a directory /tmp/build/install and create a slack-desc file for the package in that directory(after installing it as you described). Then cd into the directory /tmp/build and run: 'makepkg units-1-i486-1.tgz' Then run 'installpkg units-1-i686-1js.tgz' That will then install the program as /usr/bin/units 'src2pkg units-1.74.tar.gz' will do all this for you very quickly and cleanly, placing the finished package under /tmp. Then 'installpkg /tmp/units-1.74-i486-1.tgz' will install it under /usr/bin. You might go to the linuxpackages.net site and find their guide on creating packages in order to understand better what a package should look like inside and how to create one. And you might try 'exploding' a few regular slackware packages so you can see what they look like inside. Just create an empty directory, copy an already-made package in there, then cd into the directory and run: 'explodepkg ./*.tgz' |
Thanks for help. I looked at linuxpackages.net as well as some other web pages. I made a install dir with a slack-desc file and ran 'makepkg
units-1.74-i486-1.tgz'. The program works fine. I originally thought /usr/local was a place to install packages, but now I see it wouldn't be as accessible. I ran across this from "How to make a slackware package" at linuxpackages.net Quote:
I'll take a look at src2pkg. I was also thinking of looking at checkinstall. How would these compare? |
When you create a package to install to the system directories all the files and directories usually should belong to root -otherwise regular users might not be able to access them. there are exceptions to this, but in no case should the files or dirs belong to a regular user.
src2pkg is a more complete replacement for checkinstall. It will do a much better job of creating packages for you and takes care of the whole process of unpacking, configuring, compiling and packaging. I'm the author, but you don't have to trust my judgement of it as there are lots of posts here on the forum where other users recommend it -some of them are quite advanced users perfectly capable of creating packages manually, but they find src2pkg to be very useful. checkinstall has some problems running correctly on Slackware-12 and may fail to correctly package your program. |
All times are GMT -5. The time now is 02:29 AM. |