Qt应用程序尝试加载平台插件" xcb"而不是" eglfs"

时间:2015-06-13 23:19:10

标签: arm qml qtwebkit yocto qt5.4

fido分支See tutorial上使用Yocto构建 Raspberry Pi 2 Linux发行版,包括Qt5.4 + QtWebKit + QML插件

使用以下QML脚本进行测试

root@raspberrypi2:~# more webkit3.qml 
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtWebKit 3.0

ScrollView {
    width: 640
    height: 480
    WebView {
        id: webview
        url: "http://qt-project.org"
        anchors.fill: parent
        onNavigationRequested: {
            // detect URL scheme prefix, most likely an external link
            var schemaRE = /^\w+:/;
            if (schemaRE.test(request.url)) {
                request.action = WebView.AcceptRequest;
            } else {
                request.action = WebView.IgnoreRequest;
                // delegate request.url here
            }
        }
    }
}

错误消息

  

此应用程序无法启动,因为它无法找到或加载Qt平台插件" xcb"

看起来它仍然尝试从与{11}相关的XCB plugin开始,而我指定EGLFS(??)

root@raspberrypi2:~# /usr/bin/qt5/qmlscene  webkit3.qml -platform eglfs
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
This application failed to start because it could not find or load the Qt platform plugin "xcb".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen.

Reinstalling the application may fix this problem.

为什么我会遇到这个问题?

安装了QT5插件平台

root@raspberrypi2:/usr/lib/qt5/plugins/platforms# ls -al
drwxr-xr-x    2 root     root          4096 Jun 12 12:59 .
drwxr-xr-x   18 root     root          4096 Jun 12 13:03 ..
-rwxr-xr-x    1 root     root        601864 Jun 11 15:19 libqeglfs.so
-rwxr-xr-x    1 root     root        499564 Jun 11 15:19 libqlinuxfb.so
-rwxr-xr-x    1 root     root         20576 Jun 11 15:19 libqminimal.so
-rwxr-xr-x    1 root     root        478500 Jun 11 15:19 libqminimalegl.so
-rwxr-xr-x    1 root     root        465740 Jun 11 15:19 libqoffscreen.so

请不要将我推荐给thisthis问题。信息是相同的,但不是我认为这是相同的原因。

2 个答案:

答案 0 :(得分:3)

也许qmlscene正在吃参数 - 在qml文件的名称之前传递-platform选项,或者将QT_QPA_PLATFORM环境变量设置为eglfs而不是命令行参数。

将来,您可能希望通过使用eglfs配置Qt来使-qpa eglfs成为默认选择。

答案 1 :(得分:0)

对我来说,我不得不打电话

export QT_QPA_PLATFORM="xxxxx"

在构建和运行之前。