46

I installed program (call it, for example,progA) by building it from source code, and then finally calling sudo make install and sudo ldconfig.

However, it seems apt-get hasn't gotten the memo, because when installing progB, which depends on progA, apt-get recommends I also install progA. Why is this, and what could I do?

  • I think you have to install progB manually too... – Parto Dec 3 '15 at 6:46
  • 11
    It can not be assumed that the 'custom' version you have created is the same as the package, that is a dependency. A shortcut (not recommended) would be to install the real package, and then overwrite the binary with your 'special'. As you have not been specific, I can provide no further advice. – david6 Dec 3 '15 at 6:51
  • 6
    Just don't do this. Always keep software managed by your package management strictly separate from software you compile yourself. – Reinier Post Dec 3 '15 at 10:50
56

TL;DR checkinstall is your friend ;)

sudo apt-get install checkinstall

After a installation with sudo make install your package manager knows absolutely nothing about this installation. But it knows all about a package with the same name in the Ubuntu repositories or in a PPA.

Use sudo checkinstall instead of sudo make install and use a higher version as the version in the repository to be sure, that your package manager accepts this version as correct dependency for ProgB.


Further information:

checkinstall is really nifty, since it follows what the make install command would do, in order to figure out how to build a package.

This means that if you install a program using make install, but then want to repent for your sins, all you have to do is sudo checkinstall -D make install, and that command will:

  1. follow make install to figure out what it does

  2. copy-cat make install, except in *.deb package form

  3. install from the package (exactly as make install would have, given point 1)) except also let apt-get know about it, and thus overwrite all the files exactly where make install would have put them as long as you choose YES to include the files put by make install in the home directory in the package as well -- a couple of options during the checkinstall process will let you choose (obviously though, the choice is there so you can exercise it on a case-to-case basis)

Bonus: you can also remove a package (call it progA again) installed using make install that odes not have make uninstall support by following the checkinstall process outlined so far, and then simply doing:

dpkg -r progA
  • 18
    Wow checkinstall -- THE WORLD needs to know about this! – user390136 Dec 3 '15 at 15:57
  • I added some more detail to your answer, based on trying to implement it yesterday, and the recommendations from this meta question -- please feel free to further edit it! – user390136 Dec 4 '15 at 16:44
  • Which details do you mean? – A.B. Dec 4 '15 at 16:46
  • Oh, I think they haven't appeared yet, because it is in edit review -- if you click on the link to the meta question, you will see what they are (originally, I had put them in the question body, but the recommendation was that I should put them in the accepted answer body). – user390136 Dec 4 '15 at 16:48
  • The package documentation directory ./doc-pak does not exist. Should I create a default set of package docs? – n8chz Dec 11 '15 at 21:25
13

Three options:

  1. create a fake package for progA: How to fake a package version installed? (there is an extensive example for TeXlive).

  2. create a package for progA, easier if it has a checkinstall option: How to trick apt dependencies?

  3. Build also progB from sources.

  • 1
    4. Uninstall the version of progA you compiled and install the apt-get version. 5. Install the apt-get package over the compiled version and hope for the best. – jwodder Dec 3 '15 at 13:38
1

I'd recommend using uupdate from devscripts and build the package like the original was build before.

Install required packages

$ sudo apt-get install build-essential devscripts

Download the the old package from official repository (will use MediaWiki as example) and the new tar-ball from upstream.

$ mkdir ~/Downloads/mediawiki
$ cd ~/Downloads/mediawiki
$ apt-get source mediawiki
$ wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.0.tar.gz

Run uupdate to create a new source folder from the upstream tar-ball and the old debian/control

$ cd mediawiki-1.19.14+dfsg   # depends on your Ubuntu version
$ uupdate ../mediawiki-1.26.0.tar.gz 1.26.0
$ cd ../mediawiki-1.26.0

Now you should check if you need to make changes to debian/control etc files. If you're done you can build the deb package and install it

$ dpkg-buildpackage -us -uc
$ cd ..
$ sudo dpkg -i *.deb

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.