missing Qt platform plugin xcb
-
I built an application on CentOS 7, and when I try to run it on a non-development CentOS 7 machine, I get the following error:
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.
Within my application's directory, I have distributed the following files:
Application
Application.sh
libQt5Core.so.5
libQt5DBus.so.5
libQt5Gui.so.5
libQt5Network.so.5
libQt5Widgets.so.5
libxcb.so
libicu*
... application specific libs ...
platforms/libqeglfs.so
platforms/libqlinuxfb.so
platforms/libqminimal.so
platforms/libqminimalegl.so
platforms/libqoffscreen.so
platforms/libqxcb.soWithin Application.sh, it sets the path to look for application libraries within the same directory:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./Application
I've seen this question asked many times before, but none of those solutions seem to fix this problem. It seems to be finding the xcb platform, because it identifies it as available. Why does it give an error?
-
Hi
Have you tried to see with ldd if it misses a plugin or so file for
xcb on the machine where it dont start. -
@mrjj
I am having a very similar problem. The application is built on CentOS 7. But we're also running the application on the system it was built on.ldd doesn't show anything missing. QTDIR is set to the qt 5.6.1 dir which contains
lib
,include
,bin
,plugins
, etc.The error:
$ LD_LIBRARY_PATH=. ./application This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". Reinstalling the application may fix this problem. Aborted (core dumped)
ldd output:
$ LD_LIBRARY_PATH=. ldd ./application linux-vdso.so.1 => (0x00007ffd6068b000) libApplication.so.1 => ./libApplication.so.1 (0x00007ffa421b9000) libhunspell.so.1 => ./libhunspell.so.1 (0x00007ffa3e54e000) libprotobuf.so.8 => ./libprotobuf.so.8 (0x00007ffa3e104000) libopencv_core.so.3.0 => ./libopencv_core.so.3.0 (0x00007ffa3dbfd000) libQt5Widgets.so.5 => <QTDIR>/lib/libQt5Widgets.so.5 (0x00007ffa3d386000) libQt5Gui.so.5 => <QTDIR>/lib/libQt5Gui.so.5 (0x00007ffa3cb8d000) libQt5Xml.so.5 => <QTDIR>/lib/libQt5Xml.so.5 (0x00007ffa3c952000) libQt5Core.so.5 => <QTDIR>/lib/libQt5Core.so.5 (0x00007ffa3c23e000) libGL.so.1 => /lib64/libGL.so.1 (0x00007ffa3bf8d000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffa3bd71000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ffa3ba69000) libm.so.6 => /lib64/libm.so.6 (0x00007ffa3b766000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ffa3b550000) libc.so.6 => /lib64/libc.so.6 (0x00007ffa3b18e000) libuuid.so.1 => /lib64/libuuid.so.1 (0x00007ffa3af88000) librt.so.1 => /lib64/librt.so.1 (0x00007ffa3ad80000) libQt5XmlPatterns.so.5 => <QTDIR>/lib/libQt5XmlPatterns.so.5 (0x00007ffa3a7ab000) libQt5Network.so.5 => <QTDIR>/lib/libQt5Network.so.5 (0x00007ffa3a44a000) libQt5Sql.so.5 => <QTDIR>/lib/libQt5Sql.so.5 (0x00007ffa3a206000) libssl.so.1.0.0 => ./libssl.so.1.0.0 (0x00007ffa39f94000) libcrypto.so.1.0.0 => ./libcrypto.so.1.0.0 (0x00007ffa36a4f000) libdl.so.2 => /lib64/libdl.so.2 (0x00007ffa3684b000) libz.so.1 => /lib64/libz.so.1 (0x00007ffa36635000) libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007ffa363e4000) libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007ffa361e2000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007ffa35eab000) libXext.so.6 => /lib64/libXext.so.6 (0x00007ffa35c98000) libX11.so.6 => /lib64/libX11.so.6 (0x00007ffa3595a000) libicui18n.so.56 => ./libicui18n.so.56 (0x00007ffa354bf000) libicuuc.so.56 => ./libicuuc.so.56 (0x00007ffa35107000) libicudata.so.56 => ./libicudata.so.56 (0x00007ffa33724000) /lib64/ld-linux-x86-64.so.2 (0x00007ffa4354d000) libexpat.so.1 => /lib64/libexpat.so.1 (0x00007ffa334f9000) libglapi.so.0 => /lib64/libglapi.so.0 (0x00007ffa332cb000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007ffa330a6000) libXdamage.so.1 => /lib64/libXdamage.so.1 (0x00007ffa32ea2000) libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007ffa32c9c000) libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007ffa32a9a000) libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x00007ffa3287f000) libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x00007ffa3267a000) libxcb-dri3.so.0 => /lib64/libxcb-dri3.so.0 (0x00007ffa32477000) libxcb-present.so.0 => /lib64/libxcb-present.so.0 (0x00007ffa32273000) libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007ffa32065000) libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007ffa31e5d000) libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007ffa31c52000) libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007ffa31a4e000) libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007ffa31847000) libxcb.so.1 => /lib64/libxcb.so.1 (0x00007ffa31624000) libxshmfence.so.1 => /lib64/libxshmfence.so.1 (0x00007ffa31421000) libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x00007ffa3121b000) libdrm.so.2 => /lib64/libdrm.so.2 (0x00007ffa3100d000) libffi.so.6 => /lib64/libffi.so.6 (0x00007ffa30e04000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007ffa30ba3000) liblzma.so.5 => /lib64/liblzma.so.5 (0x00007ffa3097d000) libXau.so.6 => /lib64/libXau.so.6 (0x00007ffa30779000)
If I set QT_QPA_PLATFORM_PLUGIN_PATH it works.
QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins LD_LIBRARY_PATH=. ./application -- application runs without errors --
This started happening when we switched from qt 5.2.1 to 5.6.1-1. We would build qt 5.2.1 ourselves from source (so we could link our own build of SSL libs). On 5.6.1 we're using the qt installer to get the libs instead of building them ourselves because we no longer need to use custom built SSL libs.
We have a
plugins
directory relative to the application binary. So I thought maybe that was confusing Qt's plugin path search, so I've tried linking the content of QTDIR/plugins into the application plugins directory:ln -s $QTDIR/plugins/* ./plugins/
But that didn't work. The only thing I've found, so far, that works is setting QT_QPA_PLATFORM_PLUGIN_PATH. We can do that, but it seems like there's something wrong here and I'd like to figure out what it is.
Any ideas?
-
Hi, there are several other options available to fix this, for example, you could create a qt.conf file (and place it next to your application's .exe file) with this content:
[Paths] Plugins=plugins
or you could binary edit libQt5Core.so.5, it has a setting created by Qt's installer that points to 5.6.1's prefix directory, to see it type
strings libQt5Core.so.5 | grep prfxpath
(Qt adds plugins to that path to get 5.6.1's plugins)or you could do a call to
QCoreApplication::addLibraryPath("plugins");
just before QApplication a(argc, argv); in your main.cppand as a final option, which might be the easiest, instead of having a directory structure with a plugins directory containing the platforms subdirectory etc.. move all those subdirectories up one level, so that there is a platforms directory visible from your application's .exe file.
(That would be equivalent of creating a qt.conf file with this contents:[Paths] Plugins=.
Hope this helps!