Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Deploying QML Dependencies



  • Hi there!
    I've been working on a Qt application for embedded Linux, and would like to deploy it.
    For such, I've successfully used rcc to generate bundles containing several sets of files.

    I'd like to know whether I can use such tool to bundle all QtQuick.2, QtQml, and QtQuick files the runtime depends upon into a single rcc file. Searching the forum, I learned about windeployqt and wonder whether there's a tool like that for Linux. I have also searched the docs, but to no avail.

    Could someone kindly point an article or help topic with further information about those deployment steps? Or knows whether it is possible to create such bundle instead of copying all qml folder structure into the deployment target?

    Cheers,
    Henderson


  • Moderators

    I'd like to know whether I can use such tool to bundle all QtQuick.2, QtQml, and QtQuick files the runtime depends upon into a single rcc file

    Not sure, but it might work if you load your main QML file from resources as well.

    a tool like that for Linux

    There is an unofficial (but very good!) deployment tool: https://github.com/probonopd/linuxdeployqt.

    Could someone kindly point an article or help topic with further information about those deployment steps? Or knows whether it is possible to create such bundle instead of copying all qml folder structure into the deployment target?

    Guide to deployment is here https://doc.qt.io/qt-5/linux-deployment.html but it won't help much in your case.

    Bundles - you can create .deb, .rpm packages, or go with Flatpak - but none of these are built into Qt. You need to write your own script or deployment code in qmake.



  • Hi @sierdzio! Thank you so much for replying!

    Not sure, but it might work if you load your main QML file from resources as well.

    I do! All files are contained in rcc files. Do you know whether I can run something like rcc /my/qt/installation/qml -o quick.rcc and load it dynamically? I'm pretty worried about .so files living in /my/qt/installation/qml. My main goal is to provide a single file containing all deps Qt needs for QML handling instead of a huge tree.

    There is an unofficial (but very good!) deployment tool

    Thanks! I reviewed that tool, but it does not do what I expected...
    Can qmlimportscanner help somehow? I'm completely lost amidst those tools.


  • Moderators

    @h4xx said in Deploying QML Dependencies:

    Hi @sierdzio! Thank you so much for replying!

    Not sure, but it might work if you load your main QML file from resources as well.

    I do! All files are contained in rcc files. Do you know whether I can run something like rcc /my/qt/installation/qml -o quick.rcc and load it dynamically? I'm pretty worried about .so files living in /my/qt/installation/qml. My main goal is to provide a single file containing all deps Qt needs for QML handling instead of a huge tree.

    Yes resources can be loaded dynamically, see the documentation. https://doc.qt.io/qt-5/resources.html

    If you want a single, hassle-free package, use linuxdeployqt with -appimage flag.

    There is an unofficial (but very good!) deployment tool

    Thanks! I reviewed that tool, but it does not do what I expected...
    Can qmlimportscanner help somehow? I'm completely lost amidst those tools.



  • Hey @sierdzio! Thanks for your input!
    I was successfully able to bundle all Qt QML files into a single rcc file, and the application was able to find them!
    One last issue I have is to make Qt find .so files (such as libqtquickcontrols2plugin.so) inside that said RCC file.

    Enabling tracing shows that it attempts to load it from :/qml/QtQuick/Controls.2 as expected, but it fails:

    ...
    QQmlImportDatabase::addImportPath: ":/qml"
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "QtQuick" 2.12 as ""
    QQmlImports(qrc:/qml/main.qml)::addLibraryImport: "QtQuick.Controls" 2.12 as ""
    QQmlImports(qrc:/qml/main.qml)::importExtension: loaded ":/qml/QtQuick/Controls.2/qmldir"
    QQmlImportDatabase::resolvePlugin: Could not resolve plugin "qtquickcontrols2plugin" in ":/qml/QtQuick/Controls.2"
    QQmlApplicationEngine failed to load component
    qrc:/qml/main.qml:2 module "QtQuick.Controls" plugin "qtquickcontrols2plugin" not found
    ...
    

    I made several attempts to change the filename to qtquickcontrols2plugin, libqtquickcontrols2plugin.so, libqtquickcontrols2plugin, and qtquickcontrols2plugin, with no luck. Examining the source of QQmlImportDatabase::resolvePlugin did not help either.

    Do you know wheter this is supported?

    Again, thank you for your help.

    Best wishes,
    Henderson


  • Moderators

    I don't know if it is supported.



  • @sierdzio No problem! Will keep on searching. Once again, thanks for your help!

    Best wishes,
    Henderson