Search code examples
armqmlqtwebkityoctoqt5.4

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


Built Raspberry Pi 2 linux distro including Qt5.4 + QtWebKit + QML plugin using Yocto on fido branch See tutorial

Testing with the following QML script

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
            }
        }
    }
}

The ERROR message

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

Looks like it's still try to start with 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.

Any ideas why I am getting this issue?

QT5 plugins platforms installed

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

Please do not refer me to the this or this issues. The message is the same but not I don't think it is the same cause.


Solution

  • Maybe qmlscene is eating the arguments -- pass the -platform option BEFORE the name of the qml file, or set the QT_QPA_PLATFORM environment variable to eglfs instead of the command line parameter.

    For the future, you might want to make eglfs the default choice by configuring Qt with -qpa eglfs.