11

Recently I needed to create a deployment package for my Qt-QML application. This process is quite tedious, as you need to manually find and copy dependencies. As described in (official?) Qt Wiki:

Copy the following into C:\Deployment\

 - The release version of MyApp.exe
 - All the .dll files from C:\Qt\5.2.1\mingw48_32\bin\
 - All the folders from C:\Qt\5.2.1\mingw48_32\plugins\ (If you used QML)
 - All the folders from C:\Qt\5.2.1\mingw48_32\qml\

Do the deletion steps below in C:\Deployment\ and all of its subdirectories.
After each deletion, launch C:\Deployment\MyApp.exe and test it.
If it stops working, restore the files you just deleted.

 - Launch MyApp.exe. While it is running, try to delete all DLLs.
   The DLLs that aren't used will go to the recycle bin,
   leaving behind only the DLLs that you need.
   (This trick doesn't work for .qml and qmldir files, however).
 - (If you used QML) Delete a few .qml files and try relaunching MyApp.exe.
   Repeat until you try all .qml files.
 - (If you used QML) Delete qmldir files from the folders that have no more DLLs or .qml files

For any modern tool such procedure looks completely ridiculous. Yes, I know about windeployqt.exe, but it doesn't find all the .dll dependencies and does not help at all with .qml dependencies.

Is anyone aware of more practical approaches to this problem, how do people deal with this in big projects? Are there any tools that could help?

Are Qt developers planning to do something about it?

Aleksei Petrenko
  • 6,698
  • 10
  • 53
  • 87
  • `"Are Qt developers planning to do something about it?"` Not if they don't know that `windeployqt` isn't working, no. They'll never know if you don't file bug reports. Also, this is not really the place to ask that kind of question; there is a mailing list where you can speak with Qt developers. By the way, `windeployqt` does find `.qml` dependencies, as I've used it successfully a week or two ago. – Mitch Feb 04 '16 at 08:16
  • Not for my project though, `windeployqt` doesn't put QtQuick, QtQuick.2, GraphicalEffects and similar folders into my deploy folder. It also fails with .dll dependencies of dependencies and with non-Qt dependencies. I decided to ask here because of the instruction I've found on qt wiki. If deployment tool worked, who would write such instruction? – Aleksei Petrenko Feb 04 '16 at 08:20
  • Well, probably I should post this as a `windeployqt` bug to Qt bug tracker, thanks. – Aleksei Petrenko Feb 04 '16 at 08:20
  • The official documentation is linked to in that Wiki article. Anyone who bothers to create a Qt Account can edit that Wiki, I think. – Mitch Feb 04 '16 at 12:52
  • After lots of attempts to do deployment process as effective as possible I've came to conclusion that it can be easy done with external tools. As for me I use Inno Setup. I have a template config file and just modify it a bit for specified target. It copies, for exampe QtQuick and QtQuick.2 folders, but not all the files and only dlls I need. Usually QML project is 1 exe file + set of *.qml files. All Qt part (Qt5*.dlls etc) isn't change – folibis Feb 04 '16 at 23:04
  • 1
    I'm not aware of any tool that automatically finds all Qt dependencies while leaving out the unneeded files. However, if you'd like to talk directly to Qt developers, you can subscribe to the Interest mailing list and post there: http://lists.qt-project.org/mailman/listinfo/interest – JKSH Feb 05 '16 at 04:19
  • My two cents: I have used windeployqt both successfully and unsuccessfully in the same project. The first two deployments went well, afterwards the app ran but did not open (by this I mean that no library errors were reported and some startup code did run but no windows were shown). This usually happens when using QML and not deploying all required components. My theory is that there is an issue with import depth, maybe the tool cannot follow more than N levels deep. The solution was brute force copying everything (and cleaning up). If I find more tangible information I will post a bug report. – adapar Sep 29 '16 at 13:22

1 Answers1

24

For windeployqt there is the option --qmldir.

windeployqt --qmldir f:\myApp\sources f:\build-myApp\myApp.exe

So it checks also the import and fetches the qml dlls too.

All of this is described in the linked article

RvdK
  • 19,580
  • 4
  • 64
  • 107