该应用程序无法启动,因为它无法找到或加载Qt平台插件"xcb".在“"中 [英] This application failed to start because it could not find or load the Qt platform plugin "xcb" in ""

查看:3378
本文介绍了该应用程序无法启动,因为它无法找到或加载Qt平台插件"xcb".在“"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Qt5(通过PyQt)运行的应用程序.我正在使用miniconda,并且python代码已被cythonized.该代码已在我的本地计算机上设置,从原始.py文件生成的cython代码以及安装在miniconda中的相关库和模块使代码能够成功运行.然后,我将所有内容运送到另一台计算机,编译cython代码以提供.so文件并尝试运行它.此时,我得到了错误:

I have an application which runs using Qt5 (via PyQt). I am using miniconda and the python code has been cythonised. The code was setup on my local machine, the cython code produced from the original .py files and the relevant libraries and modules installed in miniconda such that the code runs successfully. Then I ship everything to another machine, compile the cython code to give .so files and attempt to run it. At this point I get the error:

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)

很长一段时间以来,我一直在寻找可能的解决方案,并且我还提供了以下额外信息:

I have looked around for a long time for possible solutions and I have the following extra information:

我已经检查了各种.so文件上的ldd.所有人似乎都找到了所需的库.

I have checked ldd on the various .so files. All seem to find the required libraries.

我尝试了locate libqxcb.so,并且返回: ~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so & ~/miniconda3/plugins/platforms/libqxcb.so

I have tried locate libqxcb.so and this returns: ~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so & ~/miniconda3/plugins/platforms/libqxcb.so

根据建议这里来自TranslucentCloud,我已将其复制到目录~/miniconda3/bin/platforms(新创建)中.

Based on the suggestions here from TranslucentCloud, I have copied this to the directory ~/miniconda3/bin/platforms (newly created).

我还在调用我的代码的脚本中包含了export QT_DEBUG_PLUGINS=1.这给出了以下输出:

I have also included export QT_DEBUG_PLUGINS=1 in the script which calls my code. This gives the following output:

QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "~/miniconda3/bin/platforms/libqxcb.so"
Found metadata in lib ~/miniconda3/bin/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 329218
}


Got keys from plugin meta data ("xcb")
loaded library "~/miniconda3/bin/platforms/libqxcb.so"
xkbcommon: ERROR: failed to add default include path ~/Programmes/miniconda3/lib
Qt: Failed to create XKB context!
Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, add ':' as separator to provide several search paths and/or make sure that XKB configuration data directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/xcbglintegrations" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platformthemes" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platforminputcontexts" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/styles" ...
Fontconfig error: Cannot load default config file
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/accessiblebridge" ...
QXcbConnection: XCB error: 145 (Unknown), sequence: 165, resource id: 0, major code: 139 (Unknown), minor code: 20
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/imageformats" ...
QLibraryPrivate::unload succeeded on "~/miniconda3/bin/platforms/libqxcb.so"

现在,GUI加载并且按钮等正常工作.但是,仍然存在一些问题-次要问题是所有字体都与我的本地计算机不同(不是主要问题,但大概表明它仍未找到一些相关的库).

The GUI now loads and buttons etc work. However, there are still a few issues - the minor issue is that all the fonts are different from my local machine (not a major problem, but presumably indicative that it's still not finding some relevant libraries).

更严重的是,GUI不响应任何按键-GUI填充了许多文本框,因此使其无法使用.

More seriously, the GUI doesn't respond to any key presses - the GUI has lots of text boxes to fill in so this makes it unusable.

上面的输出中显然仍然存在一些错误,但是,由此尚不清楚哪些库等仍然找不到(或为什么这样).

There are clearly some errors still in the output above, however, it's not clear from this which libraries etc. it is still unable to find (or why this is the case).

推荐答案

要解决上述错误,必须采取许多步骤:

A number of steps were necessary to resolve the errors above:

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)

这可以通过将~/miniconda3/plugins/platforms复制到~/miniconda3/bin来解决.

This can be resolved by copying ~/miniconda3/plugins/platforms to ~/miniconda3/bin.

除了在启动Qt GUI的bash脚本中,我还添加了以下几行,否则GUI中的所有文本均显示在Courier中:

In addition in the bash script which launches the Qt GUI I have added the following lines, otherwise all the text in the GUI appears in Courier:

export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export FONTCONFIG_PATH=/etc/fonts/

最后,我还需要以下行来允许GUI注册按键:

Finally I also needed the following line to allow keypresses to be registered by the GUI:

export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb

解决此问题的关键是这一行: export QT_DEBUG_PLUGINS=1这使我能够看到Qt在哪里破裂.

Key to resolving this was the line: export QT_DEBUG_PLUGINS=1 which enabled me to see where Qt was breaking.

这篇关于该应用程序无法启动,因为它无法找到或加载Qt平台插件"xcb".在“"中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆