2

I am trying to deploy a simple Qt based chat program, that uses a WebWidget for the chat itself, QListWidgets and some labels. As well as QWebSocket for the network connection. But I do need to add 120 MB files to deploy it.

This are my QT and CONFIG variables in the pro file:

CONFIG += qt release
QT     += gui websockets webkitwidgets widgets

This is the list of files I had to add:

│   D3Dcompiler_47.dll
│   icudt54.dll
│   icuin54.dll
│   icuuc54.dll
│   libEGL.dll
│   libgcc_s_dw2-1.dll
│   libGLESV2.dll
│   libstdc++-6.dll
│   libwinpthread-1.dll
│   opengl32sw.dll
│   Qt5Core.dll
│   Qt5Gui.dll
│   Qt5Multimedia.dll
│   Qt5MultimediaWidgets.dll
│   Qt5Network.dll
│   Qt5OpenGL.dll
│   Qt5Positioning.dll
│   Qt5PrintSupport.dll
│   Qt5Qml.dll
│   Qt5Quick.dll
│   Qt5Sensors.dll
│   Qt5Sql.dll
│   Qt5Svg.dll
│   Qt5WebChannel.dll
│   Qt5WebKit.dll
│   Qt5WebKitWidgets.dll
│   Qt5WebSockets.dll
│   Qt5Widgets.dll
│
├───audio
│       qtaudio_windows.dll
│
├───bearer
│       qgenericbearer.dll
│       qnativewifibearer.dll
│
├───iconengines
│       qsvgicon.dll
│
├───imageformats
│       qdds.dll
│       qgif.dll
│       qicns.dll
│       qico.dll
│       qjp2.dll
│       qjpeg.dll
│       qmng.dll
│       qsvg.dll
│       qtga.dll
│       qtiff.dll
│       qwbmp.dll
│       qwebp.dll
│
├───mediaservice
│       dsengine.dll
│       qtmedia_audioengine.dll
│
├───platforms
│       qwindows.dll
│
├───playlistformats
│       qtmultimedia_m3u.dll
│
├───position
│       qtposition_positionpoll.dll
│
├───printsupport
│       windowsprintersupport.dll
│
├───sensorgestures
│       qtsensorgestures_plugin.dll
│       qtsensorgestures_shakeplugin.dll
│
├───sensors
│       qtsensors_generic.dll
│
├───sqldrivers
│       qsqlite.dll
│       qsqlmysql.dll
│       qsqlodbc.dll
│       qsqlpsql.dll
│
└───translations
        qt_ca.qm
        qt_cs.qm
        qt_de.qm
        qt_en.qm
        qt_fi.qm
        qt_fr.qm
        qt_he.qm
        qt_hu.qm
        qt_it.qm
        qt_ja.qm
        qt_ko.qm
        qt_lv.qm
        qt_ru.qm
        qt_sk.qm
        qt_uk.qm

QtPositioning, Sql dlls, Qml and QtQuick? Last time I deployed a Qt program was with Qt4; I remember I had less dependencies.. Is there something wrong?

  • How did you generate this list? Your rigth, it shouldn't be that much (and normally isn't) – Felix Feb 13 '16 at 09:46
  • Possible duplicate of [Do I have to include all these Qt dlls with my application?](http://stackoverflow.com/questions/17736229/do-i-have-to-include-all-these-qt-dlls-with-my-application) – demonplus Feb 13 '16 at 11:18
  • I suspect webkit by default might be pulling in a lot of extra things (multimedia, positioning, ...). I don't get why Qt Quick gets pulled in though. – peppe Feb 13 '16 at 13:34
  • @Felix I copied the required files with windeployqt.exe. –  Feb 14 '16 at 23:40

1 Answers1

2

You might want to do your own Qt build and cut it down as much as possible. It will still be a mess, but a smaller one. Remove optional modules you don't need, resort to using system libraries instead of those bundled with Qt wherever possible, don't use ICU - that alone will cut almost 30MB of dependencies.

The best option is to use a static build and link statically, but there are plenty of limitations at play, you either need a commercial license or to open your code, and still, deployment for QML projects is and has been broken for years. Sadly, it seems like making the lives of all of those using Qt for free as miserable as possible has become quite a priority, in order to force developers into spending on the expensive commercial license, which is the sole remedy to the situation, or at least it will be hopefully by the time Qt 5.7 is released.

BTW, if those DLLs got pulled in by the deployment tool - I advice against trusting it. I have tried it literally yesterday, and it turned out to be completely broken - failed to pull in half of the needed DLLs, half of those it pulled in weren't actually needed, and in terms of qml files, it did even worse.

If not by the deployment tool, those extra dlls are probably indirect dependencies - for example the web sockets define a QML API, so they might pull QML in as a dependency, which itself pulls a cascade of other modules and libraries. You should investigate if you can build those modules without their QML side.

dtech
  • 47,916
  • 17
  • 112
  • 190
  • I tried compiling Qt statically, but it took almost 5 GB (but that's not a real problem) but it exited with an error, I couldn't resolve/trace back. So my quick solution was to ship the dlls as well. Yes, indeed, this files were copied by the deployment tool. I'll try to delete some of the dlls and check what happens. Thanks. –  Feb 14 '16 at 23:43
  • OK, I checked it. I can leave out all folders except for "platforms". But the dlls like Qt5Qml.dll, Qt5Quick, Qt5Positioning.dll and so on are required. :/ Too bad. I think I should try the static build. Thanks! –  Feb 14 '16 at 23:52
  • 1
    Get msys2, then `pacman -Ss qt5 static` then `pacman -S actual_package_name` - this will get you a static Qt build + all dependencies, just make sure you aren't running any antivirus, because the binary patcher might error out on you. Setup the compiler, debugger and qt version that you got through msys in Creator, make a kit and you are good to go. – dtech Feb 15 '16 at 00:28
  • I'll give it a try. Thanks! –  Feb 15 '16 at 07:43
  • It seems that the static qt version doesn't contain webkit. qmake fails with the error _Project ERROR: Unknown module(s) in QT: webkitwidgets_. I guess, I have to compile it myself then. –  Feb 15 '16 at 08:28