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.
Related
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.
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.
I have created a program in Qt using Qt Creator. When I open it, the message appears "The program can't start because Qt5Cored.dll and Qt5widgetsx.dll is missing from your computer. Try reinstalling the program to fix this problem."
copy required libraries from you Qt installation to the directory of executable.
Have you really got a static compiled version of Qt? and are you statically compiling your project?... if so your output executable will be around 30-40mb.... and it won't be asking you for dlls.
However it looks like you have a dynamically linked output, in which case you need to find all the DLLs that your projects uses. You can get these from the folder:
<installpath>\Qt\5.5\mingw492_32\bin for example (different if you use linux / msvc)
Keep running the program and grab each dll it complains about... or use somthing like dependency walker (a free executable you can find online) to help determine which DLLs you need.
You probably need (For windows, using mingw):
Qt5Widgets.dll
Qt5Gui.dll
Qt5Core.dll
libwinpthread-1.dll
libstdc++-6.dll
libgcc_s_dw2-1.dll
Or the debug version in your case which end in "d" e.g.: Qt5Core.dll (release), Qt5Cored.dll (debug). Note versions may be different for your installation version. Copy these files next to your executable. OR include <installpath>\Qt\5.5\mingw492_32\bin in your path.
You need to add all the required dlls
C:\Qt\5.2.1\mingw48_32\bin\
to your project. https://forum.qt.io/topic/50705/solved-qt3d-executable-error-qt5cored-dll-is-missing-from-your-computer/2 should solve your problem.
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.
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.
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).