views:

58

answers:

2

I am looking for tips on how to package my Qt-based application for Ubuntu/Debian distributions. Let's say the application (executable) is myapp. Running objdump -p myapp | grep NEEDED, I see that it has the following dependencies:

libicuuc.so.44
libicui18n.so.44
libicudata.so.44
libQtGui.so.4
libQtCore.so.4
libpthread.so.0
libstdc++.so.6
libm.so.6
libgcc_s.so.1
libc.so.6

I have gone through several online documents (listed at the end of this question), but am still fuzzy on where to install the actual files.

The Debian Filesystem Hierarchy Standard would suggest (I think) installing myapp in /usr/local/bin but I'm not sure about the ICU and Qt libs. It's important that the exact version of some of these libraries are used. (They have draft APIs which are being utilized that might break in future versions.)

  • I want to avoid "shared library hell" so that would incline me to place them in the application directory (/usr/local/bin), but the Debian Filesystem Heirarchy Standard would seem to discourage that.
  • I could place them in /usr/local/lib/myapp but then how do I ensure the correct version is linked dynamically? And if I do this, what do I have to do to add this directory to LD_LIBRARY_PATH on the target system?

As you can tell, I'm quite new to packaging for Ubuntu systems, so the direction I'm going may be completely wrong. I'm interesting in hearing from others who are doing this as to what they have found works best, particularly from a stability and ease-of-maintenance perspective.

Here are some of the docs I have gone through thus far:

+3  A: 

You need to look at the control section. You should not be distributing those shared libraries unless you are building them from source in your code. Those libraries belong to other packages that you need to list as Depends or Build-Depends for your package.

You say you are new to packaging on Ubuntu systems, what platforms have you packaged for? If it was only Windows, you are used to dll hell. It is much easier to avoid on Linux since you can say it requires certain libraries to be installed and the package installer knows how to find those libraries.

Adam W
I am building at least one of the libraries from source, with possibly some modifications. (I will add a suffix to the lib if this is the case.) What do I do then? Also, can I tell the system to NOT allow a future version to be used, i.e. where the so.44 becomes a symbolic link to so.50? My users will mostly be installing offline. How do I tell the package manager to find dependencies from an offline source? Thanks for the help!
Dave
And yes, my experience up to this point is Windows. The solution there seems to be just to drop the libs you need in the application folder and all is well. The ICU libraries recommended this procedure for all platforms (unless I am reading the doc incorrectly) ... hence my confusion.
Dave
@Dave: Take a look here: http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/In the Depend section you state: `qt (= 4.6.3)` or something like that for each library and version you need. Just check the versions of the libraries you are using and set the conditions accordingly.
Adam W
Adam W
"drop the libs in the app folder" is mostly intended for Win32. Do you need to modify the ICU libraries? It's simpler if you don't need to.
Steven R. Loomis
@Steven: The only modifications I am doing at the moment are using the `define U_USING_ICU_NAMESPACE 0` edit and defining `U_CHARSET_IS_UTF8=1`. But I'm also using the C++ and draft API's, and the README leads me to believe these are not available (or might be fragile) if ICU is installed as a system library. Am I reading that right? Also, `libicu44` results in "dependency cannot be resolved" in a clean install of Ubuntu 10.04. :(
Dave
Adam W
@Adam: Thanks; I really do appreciate all the help--sorry I'm such a noob to all this! How exactly do I package that separately? Do you mean include `libicu44` in the `Depends:` section, and then there is some other command that says, "By the way, here is where you can get that dependency," which points to ... what? At the end of the day, I'm looking for a one-click install from a CD to users who are by and large disconnected from the internet. Any possible dependencies need to be able to be resolved locally.
Dave
@Dave: Well now you are getting outside of my experience, but you might have to setup the CD as a repository (like a PPA if you have ever used one). Take a look here: http://www.isotton.com/software/debian/docs/repository-howto/repository-howto.html then just create a package for `libicu44` and one for your application that are both in the repository. Then you need to add that repository as a source for `apt` (if I remember correctly, haven't used Ubuntu in quite a while).
Adam W
Thanks, Adam. I really appreciate all your help!
Dave
A: 

If you really want to make sure that your application uses the libraries that you ship it with, it probably makes sense to just do static linking of the license allows it. Since you are using a special, specific version of the libraries, you don't really want any other applications to use your libraries instead of the system libs supplied by the package management system. I've built static version of Qt before, and it's somewhat inconvenient, but not enormously moreso than building the usual dynamically linked version of Qt. I haven't worked with ICU, but I imagine it's no worse.

Failing that... Yeah, stuff it all in the application's directory, neatly away from the rest of the system. In my experience, most apps that do that sort of thing don't follow any official distribution standards for doing so, so users don't have very specific expectations in that regard.

wrosecrans