mingwm10.dll missing in the bin folder - qt

I was trying to create a exe file of my Qt project.
I found this post: How to create executable file for a Qt Application?
and realised that i dont have a mingwm10.dll file in that directory.
Are there any other ways of creating a exe file or any other location where mingwm10.dll might be located?
I am using qt 5.6.

mingwm10.dll is a runtime file for the MinGW.org toolchain. Qt moved towards a MinGW-w64-based toolchain (which is essentially an expanded and newer implementation of the Win32 headers and import libraries), which doesn't have this runtime dependency. Ignore it, you don't need it. You might need the libgcc and libstdc++ DLLs though, but that's the same with any (non-statically built) toolchain.
Note you can use the windeployqt utility to automatically copy over all runtime depencies of an executable. You can enable it by adding windeployqt to CONFIG if you're using qmake, or you could just run it yourself:
windeployqt my_app.exe
This command will copy all DLLs (including the Qt platform plugins etc.) so that the application can be run by e.g. double-clicking, instead of only in the specific environment of an IDE.

Related

windeployqt copies a lot of unneeded files

I am using windeployqt to create an executable with the correct dependencies for a very simple Hello World type QML application. When using this, with the command
windeployqt . --release --qmldir D:\Documents\QT-Projects\HelloQML
in a folder with the executable in. This works fine, and I can run the executable with no problem. However, I have found that I can delete many of the files and folders in the directory with no consequence on running the program. For comparison, here is the original folder contents.
And here is the folder after I have deleted all of the things I could, while still allowing the program to run (I did not try deleting anything in any of the subfolders).
Is there a way for windeployqt to not copy so many unnecessary items?
If you use one of the latest Qt versions you can select which files not to copy.
A binary which doesn't use translations and OpenGL, can for example use:
windeployqt.exe C:\sample\sample.exe --no-translations --no-opengl-sw
For more information you can run:
windeploy --help
Usage: windeployqt [options] [files]
Qt Deploy Tool 5.12.0
The simplest way to use windeployqt is to add the bin directory of your Qt
installation (e.g. <QT_DIR\bin>) to the PATH variable and then run:
windeployqt <path-to-app-binary>
If ICU, ANGLE, etc. are not in the bin directory, they need to be in the PATH
variable. If your application uses Qt Quick, run:
windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary>
Options:
-?, -h, --help Displays this help.
-v, --version Displays version information.
--dir <directory> Use directory instead of binary directory.
--libdir <path> Copy libraries to path.
--plugindir <path> Copy plugins to path.
--debug Assume debug binaries.
--release Assume release binaries.
--pdb Deploy .pdb files (MSVC).
--force Force updating files.
--dry-run Simulation mode. Behave normally, but do not
copy/update any files.
--no-patchqt Do not patch the Qt5Core library.
--no-plugins Skip plugin deployment.
--no-libraries Skip library deployment.
--qmldir <directory> Scan for QML-imports starting from directory.
--no-quick-import Skip deployment of Qt Quick imports.
--no-translations Skip deployment of translations.
--no-system-d3d-compiler Skip deployment of the system D3D compiler.
--compiler-runtime Deploy compiler runtime (Desktop only).
--no-compiler-runtime Do not deploy compiler runtime (Desktop only).
--webkit2 Deployment of WebKit2 (web process).
--no-webkit2 Skip deployment of WebKit2.
--json Print to stdout in JSON format.
--angle Force deployment of ANGLE.
--no-angle Disable deployment of ANGLE.
--no-opengl-sw Do not deploy the software rasterizer library.
--list <option> Print only the names of the files copied.
Available options:
source: absolute path of the source files
target: absolute path of the target files
relative: paths of the target files, relative
to the target directory
mapping: outputs the source and the relative
target, suitable for use within an
Appx mapping file
--verbose <level> Verbose level (0-2).
Qt libraries can be added by passing their name (-xml) or removed by passing
the name prepended by --no- (--no-xml). Available libraries:
bluetooth concurrent core declarative designer designercomponents enginio
gamepad gui qthelp multimedia multimediawidgets multimediaquick network nfc
opengl positioning printsupport qml qmltooling quick quickparticles quickwidgets
script scripttools sensors serialport sql svg test webkit webkitwidgets
websockets widgets winextras xml xmlpatterns webenginecore webengine
webenginewidgets 3dcore 3drenderer 3dquick 3dquickrenderer 3dinput 3danimation
3dextras geoservices webchannel texttospeech serialbus webview
Arguments:
[files] Binaries or directory containing the binary.
Some of these files may be needed when deploying your Application to another PC.
For Example you deleted the opengl32sw.dll.
I found that this dll is not present on all PCs and needs to be part of the installation.

Qt deployment for windows copies incorrect dll for mingw

I set this build step to add deployment DLLs to my release folder:
Command: %{Qt:QT_INSTALL_BINS}/windeployqt.exe
Arguments: "%{CurrentProject:NativePath}\bin\server.exe" --no-translations
The correct QtXXXX.dll files are copied, but incorrect libstdc++-6.dll is added. The correct one is located at QTDIR/bin/libstdc++-6.dll, but instead, windeployqt.exe copies this DLL file from C:\MinGW\bin. If I try to run the application, I get this error:
How can I tell windeployqt.exe to copy mingw files from %{Qt:QT_INSTALL_BINS} instead of my MinGW installation folder?
The version of Qt I am using is Qt5.6.0-MinGW with mingw49_32.
If you don't use the batch file that sets up the environment and comes with Qt then just make sure that the first compiler g++.exe found be windeployqt.exe is the one coming with Qt and not the one that got installed with MinGW. This way the correct library will get copied.
As an example from my own current installation:
Qt is installed to C:\Qt\Qt5.8.0 and MinGW to C:\MinGW. Hence I add C:\Qt\Qt5.8.0\Tools\mingw530_32\bin before C:\MinGW\bin to my PATH. These two paths each contain a compiler g++.exe.

Using Qt Installer Framework to create my Application Installer

I want to create an installer for my Application. So, I have read about Qt Installer Framework and I tested the tutorial example and create the installer and everything work find with the example. But I have a doubt when I try to do the same process for my Application. When I compile the code a folder is created at the same level of my code:
MyApplication (my code)
build-MyApplication-Desktop_Qt_5_4_1_MinGW_32bit-Release (code compiled)
So my questions are:
What files of the compilation do I need to copy into the folder myinstaller/packages/vendor/ recommended by Qt Intaller Framework?
If I have dependencies of Qt like serialport, multimedia, and others, how do I insert these dependecies with Qt Installer Framework?
windeployqt.exe is what you want. Just run that on the command line and give it your executable as the argument. It will automatically copy in all the required Qt libraries and even provide the runtime redistributable installer. Then you can use the binarycreator to generate an installer.
You can put all the dependencies in myinstaller/packages/vendor/data, along with your exe. and eventual additional files. I recommended using i.e. dependency walker for finding all the required dependencies. Some of the binarycreator tutorials on qt are outdated; make sure you use the command
<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> <installer_name>
with the appropriate arguments.

Qt deployment; the procedure entry point ... could not be located

I have ported an existing Qt4 application Qt5 and added some extra (simple) functionality to this application.
The old application came with
libgcc_s_dw2_1.dll
libusb-1.0.dll
mingwm10.dll
QtCore4.dll
QtCored4.dll
QtGui.dll
Now, from QtCreator I am able to run my modified application, but problems occur when preparing deployment. I have used dependancy walker on my .exe and included a load of DLL's in my executables directory.
icudt51.dll
icuin51.dll
icuuc51.dll
IEShims.dll
libgcc_s_dw2-1.dll
libGLESv2.dll
libstdc++-6.dll
libusb-1.0.dll
libwinpthread-1.dll
mingwm10.dll
Qt5Core.dll
Qt5Cored.dll
Qt5Gui.dll
Qt5Guid.dll
Qt5Widgets.dll
Qt5Widgetsd.dll
QtCored4.dll
(Yes, the project size is now extremely large due to the DLL's, but in my use case this is not an issue.)
And finally it didn't complain about missing DLL's. The error message posted when trying to execute the .exe is:
The procedure entry point ?testBit#QBitArray##QBE_NH#Z could not be located in the dynamic link library Qt5Core.dll
I have never tried executing a Qt application outside Qt Creator, so I have really no idea what to do.
If it helps:
Under Projects-> qmake build config : Release -> Effective qmake call I have
qmake.exe D:\Product\test_util.pro -r -spec win32-g++
If any more information is required to make anything more clear, please leave a comment about it.
I had the same problem on Qt 5.4.2 after slightly modifying my code to add new functionality depending on OpenGL. What I did was use Qt's Window's Deployment tool.
Create a folder and place your binary in it
Using cmd issue the following command depending on which version of binary you have:
windeployqt --release Name_Of_Binary
windeployqt --debug Name_Of_Binary
Depending on which version of Qt Creator you have, you might have to manually copy the lib*.dll's to the directory. This bug is not present in Qt 5.4.2 but was present in earlier versions.

how to configure and deploy QT to run platform independently?

I am new to QT. I am using "qt creator 5" with "opencv" on ubuntu 13.04. I want to run program written and executed on my machine is to be executed as well on other windows and Ubuntu machine.
thanks in advance
On Linux:
You should place Qt so files along the release version of your executable. These are libQtCore.so, libQtGui.so and possibly the ones for other modules that you have used. These so files are in your installed Qt Directory in lib folder or in director /usr/lib/i386-linux-gnu. If you are using plugins you should place their so files in a folder named plugins beside your binary. In case of using icons and images you should ship their so files like libqico.so and libqsvg.so in a folder named imageformats.
On Windows:
You can compile your code on Windows using Qt Creator and Microsoft Visual C++ Compiler.
You should place Qt DLLs along the release version of your executable. These are Qt5Core.dll, Qt5Gui.dll and possibly the ones for other modules that you have used. These dll files are in your installed Qt Directory in bin folder. You should also place msvcr100.dll and msvcp100.dll in case you are using MSVS2010. If you are using plugins you should place their dll in a folder named plugins beside your exe. In case of using icons and images you should ship their dlls like qico.dll and qsvg.dll in a folder named imageformats.

Resources