Where to install files for Qt-based application on Ubuntu/Debian
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 toLD_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:
- Ubuntu Packaging Guide
- Creat开发者_开发问答e Ubuntu deb-package from a Qt-application
- Debian Filesystem Hierarchy Standard
- Debian Policy Manual (on system)
- Debian Developer's Reference (on system)
- Debian New Maintainers' Guide (on system)
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.
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.
精彩评论