Deploying Qt applications on Linux

Deploying applications on Linux used to be a nightmare. Featuring dozens of distributions and incompatible library versions, the most reasonable thing to do was to open-source your application and hope someone with a clue will make a package for you.

With the inclusion of both Qt 3 and Qt 4 in the Linux Standard Base (linuxbase.org), creating a binary that will run on all major distributions got a lot easier. This is the quick version of what you have to do:

- Download the LSB 3.1 Software Development Kit
- add /opt/lsb/bin to your PATH
- set the LSB_MODULES environment variable to Qt4 if you are using Qt 4
- run qmake followed by make to build your application

You should see that your application is compiled with lsbc++ instead of g++. lsbc++ is a wrapper around gcc that makes sure your binary will work on all LSB certified systems.

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

Note: To build Qt 3 based applications, you need to have Qt 3 installed. To build Qt 4 applications, all you need is the LSB SDK mentioned above.

Please let me know of any positive/negative experience you have with the LSB.


Blog Topics:

Comments