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 usedrcc
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,
andQtQuick
files the runtime depends upon into a singlercc
file. Searching the forum, I learned aboutwindeployqt
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 -
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 likercc /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...
Canqmlimportscanner
help somehow? I'm completely lost amidst those tools. -
@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 likercc /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...
Canqmlimportscanner
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 aslibqtquickcontrols2plugin.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
, andqtquickcontrols2plugin
, with no luck. Examining the source ofQQmlImportDatabase::resolvePlugin
did not help either.Do you know wheter this is supported?
Again, thank you for your help.
Best wishes,
Henderson -
I don't know if it is supported.