“Failed to load platform plugin ”xcb“ ” while laun

2019-01-03 15:47发布

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?

标签: linux qt xcb
14条回答
走好不送
2楼-- · 2019-01-03 16:33

sudo ln -sf /usr/lib/...."adapt-it"..../qt5/plugins/platforms/ /usr/bin/

It creates the symbolic link it's missed. Good for QT ! Good for VLC !!

查看更多
对你真心纯属浪费
3楼-- · 2019-01-03 16:34

As was posted earlier, you need to make sure you install the platform plugins when you deploy your application. Depending on how you want to deploy things, there are two methods to tell your application where the platform plugins (e.g. platforms/plugins/libqxcb.so) are at runtime which may work for you.

The first is to export the path to the directory through the QT_QPA_PLATFORM_PLUGIN_PATH variable.

QT_QPA_PLATFORM_PLUGIN_PATH=path/to/plugins ./my_qt_app

or

export QT_QPA_PLATFORM_PLUGIN_PATH=path/to/plugins
./my_qt_app

The other option, which I prefer is to create a qt.conf file in the same directory as your executable. The contents of which would be:

[Paths]
Plugins=/path/to/plugins

More information regarding this can be found here and at using qt.conf

查看更多
登录 后发表回答