[Qt5-feedback] Fwd: Re: Qt major versions

Craig.Scott at csiro.au Craig.Scott at csiro.au
Tue Jun 7 03:12:04 CEST 2011


On 07/06/2011, at 8:05 AM, Thiago Macieira wrote:

> Em Monday, 6 de June de 2011, às 23:45:30, Till Oliver Knoll escreveu:
>> No need to set LD_LIBRARY_PATH or the like. As far as I can tell this is
>> the most elegant solution I have come across yet on Linux (it also works
>> on Mac I think, but there you usually apply application bundles anyway,
>> together with the "name tool" (?), so the problem of locating libraries
>> is solved otherwise).
> 
> It's a bad idea to ship your own Qt libraries on Linux.

Well, in reality if you want to use anything beyond Qt 4.2 features, you don't really have a choice but to ship the Qt libraries if you want to make truly portable binary packages on linux. If you want recent Qt features, that means you have to build on a relatively recent linux distribution, but then the packages won't work on older distributions and this matters to a significant proportion of users (eg most corporate installs typically run RHEL or SuSE and these definitely tend to fall behind Qt's latest releases). Ideally, linux packages would be built to be LSB-compliant so that they would work on a wide variety of linux distributions, but even the latest LSB spec only requires Qt 4.2 (more on that in a separate post shortly).

There's no reason to be afraid of including Qt in your packages. Note that Mac and Windows packages would already have to be doing this.


> If you do that, you have to ship ALL of the Qt libraries, including the ones you don't need. Qt 
> might want to load the platform plugin, which may link to other libraries.

This is not true. You first work out which Qt libraries you need directly. Then look at what other Qt libraries they depend on using a tool like ldd. If you want to include the Qt plugins (which you might not actually need, depending on what your application does), then you simply do the same thing - use ldd to see what they depend on and ensure you include those in your package too. It's actually relatively easy to work out what you need to include. As long as you preserve the directory hierarchy, it all works seamlessly. We've been doing this for years without problems.


> And you need to set LD_LIBRARY_PATH.


There are cases where you won't need to, but without it, it does open up the opportunity for your binaries to pick up a system-provided Qt library that you may have missed and this can lead to all sorts of hard-to-trace bugs if you don't realise that's what's happening. I'd personally prefer to see LD_LIBRARY_PATH and QT_PLUGIN_PATH set before I ran the binary, if only for preventing this potential problem.

--
Dr Craig Scott
Computational Software Engineering Team Leader, CSIRO (CMIS)
Melbourne, Australia





More information about the Qt5-feedback mailing list