Wiki

Deploying to the Bazaar

by Harald Fernengel
Deploying an application on Linux can sometimes be rather tedious. There are a lot of distributions and a lot of libraries to support. One easy way out is to do the same as a famous Swedish furniture store: You ship some pieces and let the user figure out how to assemble it themselves. Unfortunately, the assembly instructions for software are often not as comprehensive as those for Billy the bookshelf.

Since 2004, Trolltech has been actively supporting the Linux Standard Base (LSB). The LSB defines an application binary interface (ABI) for Linux, guaranteeing that an LSB-compliant application will run on all LSB-compliant distributions. Currently, most mainstream Linux distributions are LSB-certified or about to be certified.

Qt 3.3 became a part of the standard with the LSB 3.1 release. To create LSB-compliant Qt applications, the LSB Software Development Kit 3.1 from www.linuxbase.org is required. After installing the SDK, /opt/lsb/bin needs to be added to the PATH environment variable, then Qt projects can be rebuilt by running qmake followed by make.

Instead of g++, each project should now be built with lsbc++. lsbc++ is a wrapper around g++ that makes sure that only LSB-compliant function calls are used. The resulting executable will then run on all LSB 3.1-compliant systems out of the box, without requiring the user to install extra packages or tweak their system in other ways.

Qt 4.1 is currently an optional LSB module that will become part of the standard in a later version. This means that Qt 4.1 applications might not run out of the box, but require installation of the extra Qt 4.1 package that most distributors ship. Most package installation tools will do that transparently when resolving the package dependencies. To build an LSB compliant Qt 4 application, the LSB_MODULES environment variable has to be set to Qt4 before building the project, as mentioned above.

If you are not using qmake, make sure to tell your build system to use lsbcc and lsbc++ instead of gcc and g++. For GNU Autotools, this can be achieved by setting the environment variables CC and CXX.

The LSB documentation, available from the LSB website, has a whole chapter about packaging your application. Currently, rpm is used to create and install packages, which is not very friendly for Debian-based distributions. However, the alien tool (available as a package for Debian and other distributions) understands LSB-compliant RPM packages and will install them. This issue is currently being fixed for the LSB 3.2 release.

The Linux Standard Base is progressively creating a platform for independent software vendors (ISVs) on Linux. Trolltech is continuing to support this effort, strengthening the "write once, deploy anywhere" promise.


Copyright © 2006 Trolltech Trademarks