Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Deploying Qt5 on Windows 7: Too Difficult
The documentation for how to deploy Qt 5 on Windows is too hidden and is missing several pieces of crucial information. This makes deploying Qt5 MUCH more painful than it really should be.
Through a lot of searching on other posts, I know I'm supposed to include platforms/qwindows.dll and platforms/qminimal.dll as well as the (somewhat stealthy) their dependency: libEGL.dll. I also know I am supposed to include the plugins my program is using, but I have no way to determine which ones they are!
I have defined the environment variable QT_DEBUG_PLUGINS to a non-zero value to try to get more info. No luck.
I have tried to deploy a debug version from the console to see if I get any useful output. No luck.
I have double checked my .pro file and stripped out any unneeded dependencies like this:
@QT -= gui
QT += core quick multimedia
CONFIG += thread qt@
But there is no documentation on EXACTLY which plugins correspond to which dependencies, so no luck here.
I temporarily removed all my QML files and replaced them with a single file that displayed a single maroon rectangle. Still no luck.
I have even tried copying ALL the plugins at Qt5.0.1\5.0.1\msvc2010\plugins into my apps directory so that I have:
But even THAT didn't work.
Everything I try, I am stuck staring at a blank white screen with no information on what I am doing wrong. It is highly frustrating!
What do I need to do differently?
You do need the QtGui module, and QtQml.
QT = core gui qml quick
For QtQuick 2 apps. Normally, no plugins apart from platform plugin (qwindows.dll. Minimal plugin is not needed) are required. Optionally, image plugins and database plugins might be needed, but that depends on your Qt build and app requirements.
I have no experience with QtMultimedia, so I can't help there. I don't have too much experience with Windows, too, to be hones. On Linux it just works.
Thank you very much for the response sierdzio.
I had thought it odd that my program would compile without those modules. I wonder why I don't get a compile issue when omitting gui or qml, but I DO get a compile issue when omitting multimedia. Maybe it is because I am using multimedia components in C++.
I discovered this morning that QT_DEBUG_PLUGINS really IS working. The issue is that I can only see the output when the program is executed by QtCreator. I was checking for output in the console with the deployed executable. I thought this would enable that behavior:
@CONFIG += console@
With QT_DEBUG_PLUGINS turned on, I found a nice list of plugins used when I exit the program. Each entry looks like this:
QLibraryPrivate::unload succeeded on "D:/Programs/Development/Qt/Qt5.0.1/5.0.1/msvc2010/plugins/mediaservice/wmfengine.dll"
Tracking down and adding these plugins to my program was pretty trivial. HOWEVER, I am still unable to deploy my program. I think it has to do with this output:
loaded library "D:/Programs/Development/Qt/Qt5.0.1/5.0.1/msvc2010/qml/QtQuick.2/qtquick2plugin.dll"
loaded library "D:/Programs/Development/Qt/Qt5.0.1/5.0.1/msvc2010/qml/QtMultimedia/declarative_multimedia.dll"
These "plugins" are in a different location than the rest and are in a different format. I am sure my program is looking for them to run, but I do not know where it is looking.
I tried pathing like this:
I also tried
But neither worked. Where do these plugins need to be placed relative to my executable? Do they have any "hidden" dependencies as with libEGL.dll for qwindows.dll?
Plugins need to be put in <your app dir>/plugins, as outlined "here":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html#creating-the-application-package. Make sure you read the note on ANGLE if you are using prebuild packages form Downloads page.
I had read that before, but I didn't notice at the time that ANGLE is included by default. I've added D3DCompiler_43.dll to my program next to my executable and placed the plugins as specified, but I'm still not able to deploy the application.
I used depends profiling on my application on another computer and got did see some Qt error messages pointing to the lines:
@import QtQuick 2.0
import QtMultimedia 5.0@
It says the modules "QtQuick" and "QtMultimedia" are not installed. I presume it really means the "QtQuick.2" and "QtMultimedia" folders I found in the directory at: Qt5.0.1\5.0.1\msvc2010\qml. However no matter where I put these folders the application cannot find them. How am I supposed to include "QML Plugins" (as opposed to regular plugins)?
One other .dll Depends found as missing was "Qt5MultimediaQuick_p.dll". While I've heard of similar dlls and plugins for everything else from Qt 4, I haven't heard of this one. What is it used for and do I need it?
[quote author="Scorx Ion" date="1363334790"]
Everything I try, I am stuck staring at a blank white screen with no information on what I am doing wrong. It is highly frustrating![/quote]
Heh I know what you mean, I'm stuck with the same stuff currently, trying to run the app built on x64 machine for VS2010 x86 on the same machine.
QtQuick 2.0 QML app, getting a full-screen window with nothing but blank white in it. Run from the QtCreator it works nicely. Sigh..
EDIT: Oh and a funny thing. Qt Widgets test app works, also QtQuick 1.1 test app - but none of the QtQuick 2.0 ones. Not our real app, nor a test hello world app. Just white screen. Interesting.
Torgeir last edited by
I needed to include these files for deployment of my application:
<DIR> QtQuick.2/(all of qml/QtQuick.2 goes here)
Then I can deploy and run it on another machine.
[quote author="Torgeir" date="1363947185"]
<DIR> QtQuick.2/(all of qml/QtQuick.2 goes here)
We're building our .qml files into the executable via .qrc. What exactly are you putting into QtQuick.2/ directory ? I would prefer not to ship the qml files separately.. :o
Oh Eureka! There indeed was a dir QtQuick.2/ under the SDK; copying this as-is under the application directory did the trick. Sweet, thanks to this thread we even have 2 hours to spare on our deadline. :D
While Qt/QML is sweet, building the windows deployment package is a real pain in the arse :o
Nantunest last edited by
It's really too cumbersome to deploy a qt/qml application on Windows.
After a lot of googling and trying now my app is working.
I am using SQLite in my project, but I am using the C++ library <QtSql/QSqlDatabase>.
I am new to qt/qml, the most difficult part was to figure out where the plugin folder had to be.
Each plugin folder (sqldrivers, QtQuick.2 ...) you use have to be in the exe folder, right?
There is a way to change search path for plugins?
Yes theres QQmlEngine::addPluginPath() for that.
Adding QtQuick/LocalStorage did the trick for the JS part..
My working set now is:
I really find it intolerable that the plugin system just silently fails when it cannot load something instead of showing a message (at least in console, preferable in a MessageBox). Totally nasty to debug.
I had a blank screen after launching my app but when i added
the problem was resolved.
teemo10 last edited by
I'm a little confused by what the docs have under: Writing a qmltypes File found here: http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-qmldir.html
First it says:
As such qmltypes files have no effect on the functionality of a QML module. Their only use is to allow tools such as Qt Creator to provide code completion, error checking and other functionality to users of your module.
It also says:
Any module that uses plugins should also ship a type description file.
So should we distribute "plugins.qmltypes" files with our app, provided that I am not interested in providing any editing capabilties to my end user on the shipped files?
I have included all of the files and directories mentioned in this thread as well as ALL of the plugins in the mingw directory to be extra safe, and my app also just shows a white screen; in fact I am using an included Qt Quick demo app, the Minehunt application. There is just no way I can get it to actually run correctly in an environment that does not have Qt installed already. It runs fine in Creator. This is so frustrating. No errors, not crashes, just a white screen.
[quote author="qttester5" date="1377757029"]I have included all of the files and directories mentioned in this thread as well as ALL of the plugins in the mingw directory to be extra safe, and my app also just shows a white screen; in fact I am using an included Qt Quick demo app, the Minehunt application. There is just no way I can get it to actually run correctly in an environment that does not have Qt installed already. It runs fine in Creator. This is so frustrating. No errors, not crashes, just a white screen.[/quote]
what is your grafic card ? have you tested it under other machines ?
If it was a problem with my graphics card, then why can the project run fine on the same machine, in a different VM that has Qt installed?
maybe the correct drivers are installed on the VM and not on the Real Machine.
No, I am using two identical VMs on same machine. One with and one without Qt.
zing0000 last edited by
In my App, I create a dialog QML object dynamically.
When deploying, I found that I had to add
The DLL is under a further subdir, "Private"
I ended up deploying the whole Controls directory for an added 6MB to the package!
Thanks to the contributors above, I would never have got here without their encouragement.
DavidGGG last edited by
Seems like a headache. For me this works:
- Use Microsoft's free tool "Process Explorer" to get a list of all DLLs used while running the exe in release mode via QT Creator (they can be showed in lower pane)
- Copy all of these to the same directory as the exe, not bothering with adding any subfilders
koahnig last edited by
See also my answer in the "other post. ":http://qt-project.org/forums/viewthread/30301/P30/#163354
That tool is interesting. Thanks for sharing. ;-)
DavidGGG last edited by
Actually I was a bit optimistic there.. The stand-alone exe ran on my primary PC but only because it had Qt installed, It didn't execute on another PC.
AFAIKT Process Explorer actually does reveal all DLLs used, with path. I did some further investigations on my primary PC by adding DLLs and folders to where Qt put my exe and renaming the folders Qt wants to use until I see in Proc Expl that it uses the ones I want it to, by making use of that Qt gives me an error message when starting the exe from within it with ctrl+R (otherwise it would be hard to guess which folder structre it wants).
A few conclusions from that adventure:
- It often needs more than the DLLs, so when you have identified a DLL it wants, then copy the entire directory with the DLL (you can try to optimize later by deleting files but the non-DLL files are usually very small, and the ones ending with "d" you can skip, they are for debug mode)
- When I rename a folder that Qt wants to use, sometimes it know about an alternate folder. For one group of DLLs, Qt itself took over the DLLs and fetched them in such an alternate folder, so they were no longer under my app in Proc Expl but under Qt, and I had to reboot Qt to stop it from doing that.
The folders imageformats, platforms, QtQuick and QtQuick.2 should be in the exe's folder, together with the rest of the DLLs; eactly which, you clearly see in Proc Expl. Could add screenshot but can't see the forum supports it.
Still doesn't work though. Don't now why, but I'd suspect it's something other than DLLs missing. And I don't have more time for this right now.
PS One DLL you and everybody else seem to require is Qt5V8.dll but it doesn't exist on my PC. Perhaps from an older version?
[quote author="DavidGGG" date="1393184567"]Actually I was a bit optimistic there.. The stand-alone exe ran on my primary PC but only because it had Qt installed, It didn't execute on another PC.[/quote]To check a deployment package on your development PC, rename your Qt installation folder. This effectively turns your PC into a Qt-free environment, so when you launch your application it won't use your development DLLs.
[quote]Still doesn't work though. Don't now why, but I'd suspect it's something other than DLLs missing. And I don't have more time for this right now.[/quote]If you use QML, you also need the qmldir files. See http://qt-project.org/wiki/Deploy_an_Application_on_Windows
[quote]Could add screenshot but can't see the forum supports it.[/quote]For now, you'll need to upload it to an external site. The forum can display external images. Anyway, there is a screenshot of the deployment folder at http://qt-project.org/wiki/Deploy_an_Application_on_Windows
ermylistru last edited by
Qt is absolutely great, fast and easy to develop apps.
But some points in it, for us newbies, are a real problem. One of them is deployment, for example, on Windows.
I had this problem and solved it as I think in a very stupid and simple way, and I want to share it in hope that it can help someone.
After compiling release version of the app, putting the exe file in a separate folder and running, I surely got a long list of messages about missing dlls, which I successfully took in "mingw482_32\bin" folder and put in my app root folder. Also I knew about the need in "bin\plugins\platforms\qwindows.dll" and copied it also. On the dev computer now the app ran OK, but if I started it on another computer, it didn't work. Windows didn't show any warning messages, but the app window did not appear on the screen, app started and was shown in task manager, but not on the screen.
I thought it might be some missing libs or plugins, which the app took from Qt install folder, to test it I renamed Qt installation folder on dev machine and vualia - app didn't work on dev machine either. So it was the point.
But how to find out which plugins the app depends on? There are quite a lot of them. I searched and read a lot on the forum here, I tried Dependancy Walker, MS Process Explorer and windeployqt.exe, all are not good to give results in a fast and comfortable way.
After some hours of headache a stupid idea came to my mind - I just began renaming folders in Qt install folder to make them unavailable for the app. I began from the top level dirs, found the one, the lack of which made my app to stop working, and then proceded to its subdirectories. In 5 minutes I found out that my app needed ..\mingw482_32\qml\QtQuick\Window.2 and qml\QtQuick.2 directories, which I coppied to my app folder like that – myappfolder\QtQuick\Window.2 and myappfolder\QtQuick.2 and it made everything work perfectly.
I understand that this is a really stupid method, but it became a hundred times faster than seaching and learning all those wierd tools which are as far from deployment as stars from earth, imho.