How to run Qt 5.1.0 application on Debian
Hi,
I created two applications using Qt 5.1.0.
On my "main" computer (Linux Mint 64-bit) I have installed the Qt library using the installer from http://qt-project.org/downloads (I installed both, the 32-bit version and the 64-bit version).
Now I want to run my applications on an other computer (Debian 32-bit) so I compiled a 32-bit version of my applications and copied them to /usr/bin. I also copied the 32-bit version of all required Qt libraries to /usr/lib. I stored the platform plug-ins libqxcb.so, libqoffscreen.so, libqminimal.so and libqlinuxfb.so in the directory /usr/lib/qt5/plugins/platforms/ and set the environment variable QT_PLUGIN_PATH to /usr/lib/qt5/plugins by editing /etc/environment. Of course I set the permission to allow all users to execute the files.
Which directories are recommended to put the applications, the Qt library files and the plug-ins in?
When I'm trying to start one of my applications it seems to find all libraries (and plug-ins) but it is unable to load the xcb plugin. This is the error message I'm getting:
Failed to load platform plugin "xcb". Available platforms are:
linuxfb
minimal
offscreen
xcb
What could be the reason for that problem?
I have already checked if I've installed all required dependencies (at least the packages listed here: http://qt-project.org/doc/qt-5.1/qtd...ments-x11.html).
I noticed that some Qt 4 libraries have been already installed on the system (likely installed by some other Qt-based applications like VLC). But I found them not in /usr/lib but rather in the subdirectory i386-linux-gnu.
Why/in which case is that subdirectory used?
On my main computer where I installed Qt using the installer the libraries are stored at /home/username/Qt5.1.0/5.1.0/gcc/lib. How has the installer configured my system to let all Qt applications know to look for the the libraries in that specific location? There's no entry in /etc/environment, ~/.profile or /etc/profile. There is also no entry for the plug-in directory (which I had to create on the other computer).
Thanks for answering :)
Re: How to run Qt 5.1.0 application on Debian
Quote:
Originally Posted by
Infinity
Which directories are recommended to put the applications, the Qt library files and the plug-ins in?
If you're doing a custom deployment, I'd store all the libraries and plugins in the application directory, say:
/usr/local/myapp/lib for Qt libs
/usr/local/myapp/plugins for Qt plugins
/usr/local/myapp/bin for the application binary
/use/local/myapp/data (or something else) for read-only application data.
The paths can be set using qt.conf which seems a better choice than manipulating the system environment.
Of course for user-space installation you can substitute /usr/local/myapp with /home/user/myapp. /opt/myapp is also a viable approach.
Quote:
What could be the reason for that problem?
A missing dependency, e.g. missing libxcb.so
Re: How to run Qt 5.1.0 application on Debian
Thanks for your answer.
Quote:
A missing dependency
libxcb.so wasn't missing. I checked the dependencies using readelf and discovered that libQt5DBus.so is required by xcb. That one was missing, my applications are running now.
Quote:
The paths can be set using qt.conf which seems a better choice than manipulating the system environment.
I will use qt.conf instead of /etc/environment to tell Qt where to look for plug-ins. But this works only for the plug-in libraries, not for the regular Qt libraries (correct?).
How tells the installer the system where to look for the Qt libraries (I found no qt.conf file)?
Re: How to run Qt 5.1.0 application on Debian
Quote:
Originally Posted by
Infinity
But this works only for the plug-in libraries, not for the regular Qt libraries (correct?).
Correct.
Quote:
How tells the installer the system where to look for the Qt libraries (I found no qt.conf file)?
For Linux based systems you can set rpath or runpath so that the loader looks for libraries in a place set during compilation or you can use LD_LIBRARY_PATH to set the directory during application startup. Qt-based apps are by no means different than any other Linux application in this regard.
Re: How to run Qt 5.1.0 application on Debian
I'm using the directory you suggested now and my applications are working. But I'm still interested so I'll check out rpath, runpath and LD_LIBRARY_PATH.