windeployqt.exe does not gather the correct DLLs
I wonder how the windeployqt.exe is used correctly.
I am using Qt 5.9.1 with x86 and x64, windows 10, installed to C:\Qt\5.9.1\msvc2015 and C:\Qt\5.9.1\msvc2015_64 via qt online installer.
I was currently using the windeployqt.exe from the x64 directory to gather the corresponding dlls to my 64 bit application (exe). I used the binarycreator to build an installer, copied the installer to another computer, installed it and my application could not be started. I found out that the windeployqt.exe took the 32 bit dlls instead of the 64 bit dlls.
I found out, that the problem is that I added the Qt install paths to the PATH environment variable, so I made some tests:
- When the install paths of both Qt installations are NOT added to the PATH environment variable, die windeployqt.exe from the 64 bit Qt is gathering the correct DLLs as well as the 32 bit version. So this is the correct beaviour of the windeployqt.exes.
- When at least one of the install paths of the Qt installations is added to the PATH environment variable, the windeployqt.exe (64 bit as well as 32 bit) is somehow taking the first Qt path set in this variable. So it depends on this path which DLLs are gathered for the installation.
It does not depend on the QTDIR environment variable, which I thought first.
Can someone reproduce this?
And / or can some explain this?
Because when you call
windeployqton the command line, you will be calling the first the system can find which will be the one in the order of the PATH environment variable.
Basically: don't modify your PATH environment variable system wide like you do especially when dealing with development software.
Qt Creator does the work for you when you develop so you don't have to do funky stuff to get your application running. If you want to use something like
windeployqtfrom the command line, IIRC, Qt already provides links with environment setup done to get a command line ready to use. So you should rather use that or like on other OS, use the full path to the executable you want to use.
Again: do not modify the PATH environment variable system wide.