How to deploy Qt app properly?
-
My pc is x64, my Qt project is build on x32 MSVC. Everything compiles in release mode, deploys simply(1 time tried with --quick) with no side options, everything works well. At PC where i've build the app.
But! When i bring that ready-to-use app to my other pc, which also x64 but windows 7, not 10, it rejects to run of course)
And then errors leads me to the hours of wasting my time for downloading .dlls and put it manually one buy one in Apps folder. And no proper answer in google as well, or at least i'm just tired of seeking for those answers.
The only help from Qt manual is app called Dependency Walker. Which was revelation to me, shows which libraries app using, awesome thing.
And after adding "strange, new-kind" .dll, which my app was demanding(api-ms-win-crt-runtime-l1-1-0.dll), it stops. It stops asking for .dlls, and this time gave me new kind of error - 0xc000007b. After that i found Dependency Walker app which was mentioned above, which shows me what .dlls is missing:
Have no idea what will happen after i bring rest of those .dlls. Will find out tomorrow.I'd be grateful to any kind of suggestions, hints, or advices from the exerienced people about "How To Deploy Qt App Propeprly".
-
Hi, Dependency Walker was an excellent tool 15 years ago, but it has not been updated since then and knows nothing the peculiarities of Windows 7 or Windows 10. For example, those .dlls that starts with "API-MS-WIN...", Dependency Walker flags them erroneously as "missing .dlls". but they are not real .dlls, just "shim files" that are part of Microsoft's refactoring effort.
That error 0xc000007b occurs when you've manually copied .dlls from C:\Windows\System32 (which contains the 64-bit version of the .dlls) instead of copying them from C:\Windows\SysWOW64 (which contains the 32-bit version of the .dlls). Admittedly Microsoft could have named the directories better, like they did 20 years ago when the moved from C:\Windows\System to C:\Windows\System32 (i.e. from 16-bit .dlls to 32-bit .dlls).
It's better to use Microsoft pre-packaged set of .dlls (the redistributable package) for x32 MSVC it's here. Just remember to run it on every computer you want to deploy your app to and you should be fine.
-
There's a more modern rewrite of Dependency Walker called Dependencies. One of the benefits of it is that it understands the newer mechanisms of recent Windows versions, like those shim dlls.
-
@hskoglund said in How to deploy Qt app properly?:
for x32 MSVC it's here.
HOLY!
Whole that qt manual should be just this little single line.
-
@Engelard said in How to deploy Qt app properly?:
@hskoglund said in How to deploy Qt app properly?:
for x32 MSVC it's here.
HOLY!
Whole that qt manual should be just this little single line.
It's in the Qt documentation at https://doc.qt.io/qt-5/windows-deployment.html
"To install the runtime libraries on the end-user's system, you need to include the appropriate Visual C++ Redistributable Package (VCRedist) executable with your application and ensure that it is executed when the user installs your application.
They are named
vcredist_x64.exe
(64-bit) orvcredist_x86.exe
(32-bit) and can be found in the folder<Visual Studio install path>/VC/redist/<language-code>
.Alternatively, they can be downloaded from the web, for example vcredist_x64.exe for Visual Studio 2015."
-
@JKSH said in How to deploy Qt app properly?:
It's in the Qt documentation at https://doc.qt.io/qt-5/windows-deployment.html
Yeah... my bad. I was in such a hurry so some lines i skipped)