0

In Ubuntu 14.04.1, I am trying to get hold of some third-party libraries to link with my C++ project. From what I have gathered, there are generally several ways of acquiring such libraries:

(1) Downloading a package using Ubuntu Software Centre,

(2) Downloading a package using Aptitude,

(3) Downloading the source code from a repository (e.g. git) and compiling from source,

(4) Downloading a zipped folder containing the headers and libraries.

My question is, what issues arise with the package manager (Aptitude) if I download and install using (3) or (4) compared to downloading using (1) or (2). It seems that if I compile from source, or download the libraries directly in a zipped folder, then Aptitude will not be aware of this. As such, will there be issue when I subsequently come to updating or deleting the package? For example, if I compile from source, how can I easily then delete all the compiled library files (such as those in /usr/bin) without having to manually search through all these directories and locating them? If I downloaded the package from Aptitude, then I could just delete the entire package using

Karnivaurus
  • 22,823
  • 57
  • 147
  • 247

2 Answers2

0

There's no real difference between (1) and (2), they're just different interfaces to the same packaging system. My suggestion is to always try to use the package manager to manage your software. If however you cannot find a suitable package for your library, you can install it yourself from source. This means that you're responsible for managing them: updating, deleting, etc. Use the /usr/local folder to install your libraries and put - "ln -s" is your friend - any executable binaries /usr/local/bin or another folder in your path. Do not use the system's install paths as this might lead to problems later. You'll be able to easily delete them without any complications.

There's a FAQ here: https://help.ubuntu.com/community/CompilingEasyHowTo

motanelu
  • 3,945
  • 1
  • 14
  • 21
0

If you don't have any dependency problems (i.e. you don't have packages which should link to the libraries you compiled yourself) then it's really not a problem that Aptitude doesn't know what you have.

If, on the other hand, you are fulfilling a dependency for Apt and dpkg, there is a simple workaround: Install your binaries where you like, and create a simple dummy package whose sole purpose is to satisfy Aptitude and dpkg. The equivs tool was created for this purpose, but it's really not hard to roll your own package from scratch, either. So if you compiled and installed some files which provide the functionality of libhorror0, create a dummy package libhorror0 and install it just so that Apt doesn't pull in the upstream package to satisfy the dependency of any package which Depends: libhorror0.

Finally, the best option is probably to actually take the final plunge and actually create a proper local .deb package of your project and install it locally. Take care to use a version number which is higher than the official current version from the upstream repository, but lower than the next official version. A common convention which is sanctioned by Debian policy is to tack on a ~suffix2 on the version number (where 2 signifies your second version; the next one should be ~suffix3, and so on). So if upstream is libhorror0-1.23-4 then yours should be libhorror0-1.23-4~karnivaurus2 for your second build (or if there is no upstream Debian package, use libhorror0-1.23-0~karnivaurus2).

Creating a .deb package from an already working project is often not very hard at all; just populate a debian directory with the necessary files (minimally rules and control but usually also a copyright notice and a changelog and some data files for Debhelper); there is a tool dh_make which does most of this for you. Maybe then even submit this upstream so that anybody can build a Debian package straight from the upstream sources.

tripleee
  • 175,061
  • 34
  • 275
  • 318