2

I started a Qt project with only C++ code in it, everything worked fine at this point. Here are my configuration and the steps I'm following to deploy my executable :

Programming on Windows10 64bits, x64 processor, Lenovo Thinkpad Tablet. Using Qt5.9 framework and MinGW32bit compiler.

  • (1) I first build the project and launch windeployqt.exe on a copy of my build directory.
  • (2) Then, I put every DLLs plus the executable into a Wix project to make a MSI package. As far as I know, the output of this MSI setup should do no more than just copying the files into the ProgramFiles directory, and adding the correct shortcuts to start menu and desktop.

At this point, everything always worked. But since a few days now, QML code was added to the project (therefore some OpenGL dependant plugins). I added a QQuickWidget which instantiates a QML geographical Map object on my viewport. After I managed to get it to work on Windows, I am no more able to get a stand-alone * executable. Running it with Qt IDE works but, but running the stand-alone * executable does not. (Sorry if the terms are not correct: stand-alone with DLLs and lot of files dependancies)

When all the DLLs are copied into the executable folder, (step 1. above) the application get stuck in background, and shows nothing. Also there is no runtime error to debug it or to find out the missing DLLs, if there are.

My thoughts are that some QML plugins are not loaded, or something went wrong with OpenGLES and Angle, here are some of the DLLs I get as dependancies :

  • D3Dcompiler_47.dll libEGL.dll libgcc_s_dw2-1.dll libGLESV2.dll libstdc++-6.dll opengl32sw.dll Qt5Core.dll Qt5Gui.dll Qt5Network.dll Qt5Positioning.dll Qt5Qml.dll Qt5Quick.dll Qt5QuickWidgets.dll Qt5SerialPort.dll Qt5Svg.dll Qt5Widgets.dll at the same level of the executable.
  • qwindows.dll into a "platforms" folder, and some other folders such as "qmltooling", "position", "platforminputcontexts" ... (EDIT and seemingly the relevant QML plugins directories).

I don't know what it could be. Has anyone any idea ?


The output when setting the environment variable QML_IMPORT_TRACE to 1. The qt.network.ssl ... messages are not part of the qml trace. I always got them since I added the QML map but it seems not to be a problem when running via Qt Creator.

QQmlImportDatabase::addImportPath: "C:/Qt/5.9/mingw53_32/qml"
QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
QQmlImportDatabase::addImportPath: "C:/Users/hermes/Documents/build-MyApplication-Desktop_Qt_5_9_0_MinGW_32bit-Release/src/release"
QQmlImportDatabase::addImportPath: "C:/Qt/5.9/mingw53_32/qml"
QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
QQmlImportDatabase::addImportPath: "C:/Users/hermes/Documents/build-MyApplication-Desktop_Qt_5_9_0_MinGW_32bit-Release/src/release"
QQmlImports(qrc:/qml.qrc/main.qml)::addLibraryImport: "QtQuick" 2.0 as ""
QQmlImports(qrc:/qml.qrc/main.qml)::importExtension: loaded "C:/Qt/5.9/mingw53_32/qml/QtQuick.2/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtQuick" from "C:/Qt/5.9/mingw53_32/qml/QtQuick.2"
QQmlImports(qrc:/qml.qrc/main.qml)::addLibraryImport: "QtQuick.Controls" 1.4 as ""
QQmlImports(qrc:/qml.qrc/main.qml)::importExtension: loaded "C:/Qt/5.9/mingw53_32/qml/QtQuick/Controls/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtQuick.Controls" from "C:/Qt/5.9/mingw53_32/qml/QtQuick/Controls"
QQmlImports(qrc:/qml.qrc/main.qml)::addLibraryImport: "QtLocation" 5.9 as ""
QQmlImports(qrc:/qml.qrc/main.qml)::importExtension: loaded "C:/Qt/5.9/mingw53_32/qml/QtLocation/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtLocation" from "C:/Qt/5.9/mingw53_32/qml/QtLocation"
QQmlImports(qrc:/qml.qrc/main.qml)::addLibraryImport: "QtPositioning" 5.5 as ""
QQmlImports(qrc:/qml.qrc/main.qml)::importExtension: loaded "C:/Qt/5.9/mingw53_32/qml/QtPositioning/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtPositioning" from "C:/Qt/5.9/mingw53_32/qml/QtPositioning"
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "PluginParameter" => "QDeclarativeGeoServiceProviderParameter" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "MapQuickItem" => "QDeclarativeGeoMapQuickItem" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "Image" => "QQuickImage" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "Rotation" => "QQuickRotation" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "Map" => "QDeclarativeGeoMap" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "Plugin" => "QDeclarativeGeoServiceProvider" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "Connections" => "QQmlConnections" TYPE
QQmlImports(qrc:/qml.qrc/main.qml)::resolveType: "Component" => "QQmlComponent" TYPE
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated
mincore\com\oleaut32\dispatch\ups.cpp(2128)\OLEAUT32.dll!74865072: (caller: 7486FE4F) ReturnHr(1) tid(2e20) 8002801D Bibliothèque non inscrite.
mincore\com\oleaut32\dispatch\ups.cpp(2128)\OLEAUT32.dll!74865072: (caller: 7486FE4F) ReturnHr(2) tid(2e20) 8002801D Bibliothèque non inscrite.
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated
11
  • Try running the application with QML_IMPORT_TRACE=1 and provide the output here.
    – Mitch
    Jun 26, 2017 at 15:18
  • 2
    @herme5 Did you use the --qmldir option of windeployqt ? And did you deploy all the folders generated by windeployqt (including those created when using --qmldir) ?
    – Benjamin T
    Jun 26, 2017 at 15:27
  • @BenjaminT. I tried the c++ command QCoreApplication::addLibraryPath("C:/path/to/plugins") instead. I always shipped all the folders generated by windeployqt but never tried --qmldir. I will get a look at this.
    – herme5
    Jun 26, 2017 at 15:36
  • 1
    @king_nak I tried running Dependency Walker , and it did not reports anything but API-MS-WIN missing dependency. But according to this topic it can be ignored as long as Windows resolves these dynamically (If i understand well).
    – herme5
    Jun 27, 2017 at 12:19
  • 1
    You have to start profiling (Menu > Profile > Start Profiling). That starts the program and makes an extensive log for all DLLs, Symbols, etc. I got errors like QQmlApplicationEngine failed to load component qrc:/main.qml:3 module "QtQuick.Controls.Styles" is not installed before copying the required QMLs to the application dir
    – king_nak
    Jun 27, 2017 at 13:07

4 Answers 4

3

for QML applications you should follow the below command while using windeploy.exe

windeployqt --qmldir [path-to-app-qml-files] [path-to-app-binary]

0

copy from the Qt install folder to your .exe folder:

  • bin\Qt5QuickControls2.dll
  • bin\Qt5QuickTemplates2.dll
  • qml\QtQuick
  • qml\QtQuick.2

so that your .exe folder looks like this:

enter image description here

If the program now runs ok, then you can go into the QtQuick folder and try to remove the libraries which you are not using in your program.

5
  • good luck. If this is not enough, try copying the entire contents of [qt_install_dir]\qml into your .exe folder, and then prune it down by trial and error.
    – Mark Ch
    Jun 27, 2017 at 8:10
  • I tried this, and I'm sorry to tell you it has no effects. I began adding the files of yours which are not among mines: only Qt5DBus.dll at all. By the way scenegraph folder is not available with MinGW (?!). Then I copied all the contents of qml folder, and then all the contents of the plugins folder, and then all the "core" DLLs (those which are in the same folder than Qt5***.dll and libGL and D3DCompiler ...). Obviously each times I gave it a try, I paid attention to kill my application process.
    – herme5
    Jun 27, 2017 at 12:08
  • I'm sorry to hear that, in that case I am unfortunately not able to help. Shall i delete my answer?
    – Mark Ch
    Jun 27, 2017 at 12:12
  • I think I'm gonna try to compile it with MSVC. By the way, I've seen several forum where windeployqt is said to be buggy and does not copy all the required files, don't know if your post can help somebody else. Feel free to delete it or not but thank you anyway !
    – herme5
    Jun 27, 2017 at 12:16
  • yes, I have been using MSVC. FYI I tried deleting scenegraph folder, and my application still runs OK.
    – Mark Ch
    Jun 27, 2017 at 12:30
0

You can use the useful windeployqt tool which gather all needed dependencies together inside release directory:

rem %1 H:\src\trunk\src\qt\cargofinder
pushd f:\qt\5.9\msvc2015_64\bin
call qtenv2.bat
popd
windeployqt --qmldir %1 .
1
  • Thank you for your answer, I'm using windeployqt.exe with a git bash unix-like terminal. So excuse my ignorance but what are you doing with the command lines you wrote ? I'm not comfortable with Windows shell, nor scripting in with batch files.
    – herme5
    Jun 28, 2017 at 14:27
0

I encountered this problem recently, I am using the compiler cl(MSVC2017), the QT version 5.12 64bit.I describe the process I solved as following:

  1. I copy all program dependent Dlls depends.exe hints. But when I double click the exe, nothing happened even appeared in the Task Mannager program.
  2. Then I learned about monitoring Dlls dependent by the Process Explorer, I find out some others dependent dlls like Qt5Quick, Qt5QuickTemplates2.dll, *Qt5QuickControls2.dll**, etc. and many Dlls in msvc2017_64\qml folder.
  3. I also used charts, so I cannot forget Qt5Charts.dll.

Okay, so far it works. So many Dlls dependent from Qt, I worn out.Tips: Copy qml floder to runtime directory, and then run the exe, then fell all other unoccupied files heartily.(ps:seemly cannot delete some unoccupied thing in qml\QtQuick, if I delete it double click the exe will have nothing happened.)

1
  • Why didn't you use the windeployqt tool? Or did you have a problem with it, which forced you to do this work by hand yourself?
    – hyde
    Apr 25, 2019 at 13:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.