Search code examples
qtqmlyocto

Qt - Module "QtQuick.Controls" is not installed


I try to deploy a QT application which works fine on a PC. The application is deployed in an image of a yocto installation, based on ASEM, with release "morty".

I receive the error message "qml: ERROR loading component: qrc:/GUI/InputDialog.qml:3 module "QtQuick.Controls" version 2.0 is not installed"

However, I don't see any trouble in the LDD output:

ldd $clientApp
    linux-vdso.so.1 (0x7ed4b000)
    libquazip.so.1 => /usr/lib/libquazip.so.1 (0x76f72000)
    libQt5QuickWidgets.so.5 => /usr/lib/libQt5QuickWidgets.so.5 (0x76f64000)
    libQt5Quick.so.5 => /usr/lib/libQt5Quick.so.5 (0x76c5e000)
    libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0x7674c000)
    libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x762dd000)
    libQt5Qml.so.5 => /usr/lib/libQt5Qml.so.5 (0x75f8d000)
    libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0x75e3d000)
    libQt5Xml.so.5 => /usr/lib/libQt5Xml.so.5 (0x75e0d000)
    libQt5Sql.so.5 => /usr/lib/libQt5Sql.so.5 (0x75dc1000)
    libQt5Test.so.5 => /usr/lib/libQt5Test.so.5 (0x75d8c000)
    libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x75861000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x75839000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x756f3000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x756c7000)
    libc.so.6 => /lib/libc.so.6 (0x7558b000)
    libGLESv2.so.2 => /usr/lib/libGLESv2.so.2 (0x75492000)
    libm.so.6 => /lib/libm.so.6 (0x75414000)
    libz.so.1 => /lib/libz.so.1 (0x753f2000)
    libpng16.so.16 => /usr/lib/libpng16.so.16 (0x753ba000)
    libmysqlclient.so.18 => /usr/lib/libmysqlclient.so.18 (0x750e9000)
    libdl.so.2 => /lib/libdl.so.2 (0x750d6000)
    libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x74fd7000)
    librt.so.1 => /lib/librt.so.1 (0x74fc0000)
    /lib/ld-linux-armhf.so.3 (0x76faa000)
    libGAL.so => /usr/lib/libGAL.so (0x74ebc000)
    libEGL.so.1 => /usr/lib/libEGL.so.1 (0x74e9d000)
    libVSC.so => /usr/lib/libVSC.so (0x74ddb000)
    libpcre.so.1 => /usr/lib/libpcre.so.1 (0x74d8c000)
    libXdamage.so.1 => /usr/lib/libXdamage.so.1 (0x74d7a000)
    libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0x74d66000)
    libXext.so.6 => /usr/lib/libXext.so.6 (0x74d48000)
    libX11.so.6 => /usr/lib/libX11.so.6 (0x74c2e000)
    libxcb.so.1 => /usr/lib/libxcb.so.1 (0x74c01000)
    libXau.so.6 => /usr/lib/libXau.so.6 (0x74bef000)
    libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x74bdb000)

The offending line in the qml code is:

import QtQuick.Controls 2.0

Without any success, I have already added the following code to the recipe:

+IMAGE_INSTALL_append = " qtquickcontrols"

The directory /usr/lib/qt5/qml/QtQuick is present and contains libqtquick2plugin.so

Adding this directory to the LD_LIBRARY_PATH prior to starting the application does not solve the issue though.

I have exported: export LD_LIBRARY_PATH=/usr/lib/qt5/qml/QtQuick.2:/usr/lib/qt5/qml/QtQuick

I wonder what file could be missing. Can please somebody provide pointers on how to debug this?

To test Amfasis idea, I now also export

export QML2_IMPORT_PATH="/usr/lib/qt5/qml" prior to starting the application in the same shell.

ls /usr/lib/qt5/qml/
    Qt  
    QtGraphicalEffects  
    QtLocation  
    QtPositioning  
    QtQml  
    QtQuick  
    QtQuick.2  
    QtTest  
    QtWebChannel  
    QtWebEngine  
    builtins.qmltypes

Nevertheless, the error stays the same.

Looks as if I was missing libQt5QuickControls.so I'll dig into this...


Solution

  • For future reference:

    The idea is to explicitly state a dependency in yocto.

    This can be achieved by adding

        RDEPENDS_${PN} = "qtquickcontrols2 \
            qtquickcontrols2-mkspecs \
        "
    

    Then, the dependency will be compiled and installed.

    It is not enough, though, to add the following (which I had before already):

    DEPENDS = "qtquickcontrols2"