Viktor Simkó Viktor Simkó - 2 months ago 21
C++ Question

Could not find Qt platform plugin 'xcb' on Debian 8.3

I've compiled a simple Qt application on Ubuntu 15.10.

I've created a lib and a platforms folder int the same directory where the executable is.

I've copied libicudata.so.54, libicui18n.so.54, libicuuc.so.54, libQt5Core.so.5, libQt5DBus.so.5, libQt5Gui.so.5, libQt5Widgets.so.5,
libQt5XcbQpa.so.5 into lib, and libxcb.so into platforms,

then moved the application with the folders to a fresh Debian 8.3 install.

I've also created a start.sh script with the following content:

export LD_LIBRARY_PATH=$PWD/lib
export QT_QPA_PLATFORM_PLUGIN_PATH=$PWD/platforms
./QtTestApp


But when I start the application using the script it says that it couldn't find Qt platform plugin 'xcb'...

I've run
ldd
on the application itself, and on the libxcb.so also, but it seems, it have found everything...

Answer

"platforms" is a subfolder of the plugins directory.

Sample structure

./QtTestApp
./qt.conf
./lib
./lib/libicudata.so.54
./lib/libicui18n.so.54
…
./lib/libQt5Widgets.so.5
./plugins/platforms
./plugins/platforms/libqxcb.so
./plugins/platforms/libqlinuxfb.so
./plugins/platforms/libqoffscreen.so
./plugins/platforms/libqminimal.so

with qt.conf

[Paths]
Prefix = .

In this case, you usually do not need to set QT_QPA_PLATFORM_PLUGIN_PATH.

LD_LIBRARY_PATH can also be avoided if you set the RPATH of ./QtTestApp to $ORIGIN/lib.


Note: it is likely that your application compiled on Ubuntu 15.10 does not run on Debian 8. This is because Ubuntu 15.10 uses a newer version of libc and libstdc++, which is not available on Debian 8. You can work around that issue when you use Ubuntu 14.04 as the compile machine. Then you have approximately this list of compatible target distributions.

Comments