1

In one of my programs I use QWebView to load and print reports made from HTML documents. So while deployment I copy these libraries, in additional to all other relevant Qt libraries:

  • Qt5WebKit.dll
  • Qt5WebKitWidgets.dll
  • Qt5PrintSupport.dll
  • plugins/printsupport/windowsprintersupport.dll

After testing on destination machine I've found that printing doesn't work. Thanks for Dependency Walker I've get all the missed libraries. Here is the list:

  • Qt5Multimedia.dll
  • Qt5Positioning.dll
  • Qt5MultimediaWidgets.dll
  • Qt5Qml.dll
  • Qt5Quick.dll
  • Qt5Sensors.dll
  • Qt5OpenGL.dll

Ok, I can understand why it wants Qt5Multimedia.dll. Browser can play sound etc. But QML! Why I need all these libraries related to QML?? I don't use neither OpenGL nor sensors or positioning. So it's just unnecessary in my case.

And so my question - is there way to deploy only libraries I need in actual fact? And get the program work of course.

1
  • If you are not interested in the DLL linking because you have a GPL (not LGPL) software anyways, you might consider statically linking QT Commented Apr 18, 2017 at 15:04

1 Answer 1

1

I would suggest you to use windeployqt.exe.

From the docs:

The Windows deployment tool can be found in QTDIR/bin/windeployqt. It is designed to automate the process of creating a deployable folder that contains all libraries, QML imports, plugins, translations that are required to run the application from that folder. This is used to create the sandbox for Windows Runtime or an installation tree for Windows desktop applications that can be easily bundled by an installer.

This is how I do:

cd [my program dir]
mkdir RELEASE
cd RELEASE
copy ..\"progname.exe" .
set QTDIR=C:\Qt\Qt5.4.1\5.4\mingw491_32\bin
call %QTDIR%\qtenv2.bat
windeployqt --force "progname.exe"

You could adapt that for your need by changing [my program dir] to your application's folder (containing the .exe file), QTDIR to your Qt MinGW folder (that's what I use) and progname.exe with the name of your executable file.

It will create a release directory with your executable and the needed Qt libraries (.dll's, etc).

Sign up to request clarification or add additional context in comments.

1 Comment

I don't use windeploy due to its limitation and short-sighted search. For example - from some reason, windeploy copied all dll in sqldrivers although i use only pgpsql. But anyway - I have no problem with libraries assembling. My problem is that Qt wants some unnecessary dlls. As I said - QWebView doesn't work without Qt5Qml.dll and Qt5Quick.dll but I don't use QML at all in my program

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.