Important: Please read the Qt Code of Conduct -

windeployqt.exe does not gather the correct DLLs

  • Hello,

    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?


  • Lifetime Qt Champion


    Because when you call windeployqt on 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 windeployqt from 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.

  • On my 64-bit machine, if I modify the path files for both 32-bit (5.11.3) and 64-bit (5.12.0), windeployqt grabs the correct QT dlls (core, gui etc.) but seems to grab the runtime dlls of the first path variable (the 64-bit one in my case).

    For example it copies the 64-bit libstdc++-6.dll into both 32-bit and 64-bit builds of a project.

    If no path is specified, it doesn't copy the compiler runtime dlls. I run each tool (32-bit / 64-bit) with its full path specified with options --release --compiler-runtime.

    Is this the right behaviour?

Log in to reply