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

Qt application trying to load platform plugin "xcb" instead of "eglfs"

fido 分支 See tutorial

使用以下 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
            }
        }
    }
}

错误信息

This application failed to start because it could not find or load the Qt platform plugin "xcb"

貌似还在尝试从XCB plugin which relates to X11 whereas I specified 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

请不要让我参考 this or this 问题。消息是一样的,但不是我不认为这是同一个原因。

可能 qmlscene 正在吃参数——在 qml 文件名之前传递 -platform 选项,或者将 QT_QPA_PLATFORM 环境变量设置为 eglfs命令行参数。

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

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

export QT_QPA_PLATFORM="xxxxx"

构建前 & 运行.