Solved Unable to build standalone .exe using windeployqt.
-
Hi,
I am trying to build an distributional executable using windeployqt, but I am not able to make standalone exe. After I move the exe to other location it throws up Qt5Widgetsd.dll is missing from your computer.Regards,
Aditya. -
@Aditya1309 said in Unable to build standalone .exe using windeployqt.:
After I move the exe to other location it throws up Qt5Widgetsd.dll is missing from your computer.
Do you move all the libs and plug-ins as well? How does your deployment folder look like after windeployqt run?
-
@Aditya1309 said in Unable to build standalone .exe using windeployqt.:
I am trying to build an distributional executable using windeployqt, but I am not able to make standalone exe.
You need to distribute the DLLs too.
Qt5Widgetsd.dll
If your executable is looking for Qt5Widgetsd.dll, that means you created a Debug build.
You should distribute a Release build instead.
-
@jsulm said in Unable to build standalone .exe using windeployqt.:
How does your deployment folder look like after windeployqt run?
It contains all dll including Qt5Widgetsd.dll. But when I move .exe to other location it does not work. I have compiled it in debug build.
-
@JKSH Thanks, Indeed I used a debug build, But when I compile using release I still face the same issue. I see two different build i.e build-<app-32-bit>-debug and build-<app-32-bit>-release. This time I used release and used windeployqt.exe <location to release exe.. [build-<app-32-bit>-release]> still facing the same issue.
-
@Aditya1309 Do you only move the exe? If so, then how could it work? You need to move the whole deployment directory.
-
Hi @Aditya1309,
It sounds like you're a little confused about the concepts here... specifically how windeploy qt affects the exe (or rather doesn't affect it). Let me see if I can shed some light on the typical process for building a distributable for Windows:
-
When you build the application (let's call it MyApp), the build process generates, for example,
MyApp.exe
- this is not a standalone exe (unless your using Qt with static linking, which is a whole other topic). -
Next, you may use windeployqt to gather all of the dependencies (that it can detect) into the same directory as the
MyApp.exe
. This is still not a standalone app - its an exe, along with a set of dll's, that must (in most cases) stay together. -
Finally, if you wish, you can generate an installer application, for example
InstallMyApp.exe
(orInstallMyApp.msi
). This is a standalone (installer) app - or at least it should be if your installer framework is any good.
The installer produced in step 3 would typically "install" (ie copy) the
MyApp.exe
app from step 1, along with all of the dependencies from step 2, into some destination folder. But at no point didMyApp.exe
become a "standalone" app - you still cannot simply copy it out and use it without the other dll's being present.There are two exceptions:
- if the dependent dll's are present elsewhere on the target machine, then sometimes copying just the
MyApp.exe
will work - this often happens on development machines, then fails for example when distributed to end users. Don't rely on this. - it is possible to statically link Qt - the default Qt installation does not support this (at least not the last time I checked), so it requires you to build Qt from source, with static-linking enabled. (Note, this has important licensing considerations!) However, if you do this, then you should not need to use windeployqt at all (or more specifically, windeployqt would only pick up on non-Qt dependencies that weren't also statically linked).
I hope that gives you a bit of a better idea of what's going on, and why you can't simply copy the exe out, even if you did run windeployqt (because windeployqt does not change the exe).
Cheers.
-
-
@Paul-Colby Thanks for the info.