Anedar
Anedar

Reputation: 4275

Where does windeployqt.exe store the Qt directory?

When trying to run windeployqt.exe, how does it know where to look for the Qt Libraries?

I'm using Windows, Qt 5.3, msvc2013_opengl.


I have the following setup:

When running C:/PathB/Qt/5.3/.../windeployqt.exe it complains, that it can not read file C:/PathA/.../QtPrintSupport.dll - of course, because that file does not exist anymore....

I tried:

Still, windeployqt insists on searching C:/PathA - so where does it get that value from?


PS: I know that i could try to uninstall all Versions of Qt, get rid of everything Qt-related and reinstall it from scratch. However thats not what i'm interested in. I'm interested in allowing multiple Versions of Qt installed next to each other and controlling, which one to use (Using CMake and Visual Studio).


Edit: In contrast to this question, i'm not using QtCreator and the scope of this question is not "How to install multiple Versions of Qt when using QtCreator?". The question is specifically "Where does windeployqt.exe get the path to the Qt libraries?"

Upvotes: 0

Views: 1804

Answers (2)

Anedar
Anedar

Reputation: 4275

As far as i can tell, the order is this:

  • If a qmake.exe with a qt.conf file is found in one of the directories in PATH, windeployqt uses <path to qmake&qt.conf>/<prefix in qt.conf>/bin
  • else if a qmake.exe is found in the same directory as windeployqt.exe, the hardcoded path qt_binspath in qmake.exe is used
  • else if a qmake.exe is found in PATH, the qt_binspath there is used
  • else windeployqt fails with "Unable to query qmake: CreateProcessW failed"

Thanks to Pedro for his hint about the hardcoded values and the suggestion to use a hex editor.

Upvotes: 1

Former contributor
Former contributor

Reputation: 2576

Quoting this page:

windeployqt takes an .exe file or a directory that contains an .exe file as an argument, and scans the executable for dependencies... Identified dependencies are then copied to the executable's directory. The hardcoded local paths in Qt5Core.dll are furthermore replaced with relative ones.

So probably you are looking for these hardcoded paths in Qt5Core.dll, you may use an hex editor to look for "qt_prfxpat".

Upvotes: 1

Related Questions