locomotion locomotion - 5 months ago 19
Linux Question

"Failed to load platform plugin "xcb" " while launching qt5 app on linux without qt installed

I wrote application for linux which uses Qt5.

But when I am trying to launch it on the linux without Qt SDK installed, the output in console is:


Failed to load platform plugin "xcb". Available platforms are:


How can I fix this? May be I need to copy some plugin file?
When I use ubuntu with Qt5 installed, but I rename Qt directory, the same problem occurs. So, it uses some file from Qt directory...

UPDATE:
when I create in the app dir "platforms" folder with the file libqxcb.so, the app still doesnot start, but the error message changes:


Failed to load platform plugin "xcb". Available platforms are:

xcb


How can this happen? How can platform plugin be available but can't be loaded?

Answer

Use ldd (man ldd) to show shared library dependencies. Running this on libqxcb.so

.../platforms$ ldd libqxcb.so

shows that xcb depends on libQt5DBus.so.5 in addition to libQt5Core.so.5 and libQt5Gui.so.5 (and many other system libs). Add libQt5DBus.so.5 to your collection of shared libs and you should be ready to move on.