microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.9k stars 6.32k forks source link

[qt5] `windeployqt` fails on `Debug` configurations (x64-windows) #17840

Open FranciscoPombal opened 3 years ago

FranciscoPombal commented 3 years ago

EDIT: Release configurations work fine (see https://github.com/microsoft/vcpkg/issues/17840#issuecomment-838897472), so related content was removed from the OP and the issue title edited accordingly as well.

Found this while helping investigating a similar problem with https://github.com/microsoft/vcpkg/pull/14333.

Describe the bug

Qt5 windeployqt.exe will fails on Debug configurations (the triplet used is x64-windows).

Environment

To Reproduce

  1. Install the Qt5 and non-Qt5 packages needed to build a CMake project that uses windeployqt.exe to deploy runtime DLLs as one of the final steps of its build.
  2. Build the project in Debug mode.

As an MRE, consider installing the following packages...:

boost-circular-buffer:x64-windows
libtorrent:x64-windows
qt5-base:x64-windows
qt5-svg:x64-windows
qt5-tools:x64-windows
qt5-translations:x64-windows
qt5-winextras:x64-windows

... in order to build this patch: https://github.com/qbittorrent/qBittorrent/pull/14959.

Then try to build in Debug mode; the compilation of the executable itself will succeed, but the build will ultimately fail due to windeployqt errors:

cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DVERBOSE_CONFIGURE=ON
cmake --build build
cmake --install build --prefix install_dir

An identical failure to this one in vcpkg's Qt5 port was also observed previously in https://github.com/microsoft/vcpkg/pull/14333 during its developement (it has since been fixed there):

Qt binaries in C:\vcpkg\installed\x64-windows\bin
readPeExecutable: C:\Users\User\source\repos\qt5-temp\qBittorrent\build\qbittorrent.exe 64 bit, dependent libraries: 23, debug
Unable to find dependent libraries of C:\vcpkg\installed\x64-windows\bin\Qt5Widgetsd.dll :Cannot open 'C:/vcpkg/installed/x64-windows/bin/Qt5Widgetsd.dll': The system cannot find the file specified.

Expected behavior

windeployqt.exe should work correctly and find all required DLLs when building with the Debug configuration.

Additional context

For comparison, here is a successful Debug build of qBIttorrent (the example project mentioned for the MRE above) using precompiled Qt and OpenSSL binaries from the official Qt distribution (plus Boost, libtorrent, and zlib binaries that I compiled from source myself, vcpkg was not used here at all):

Click to expand ```txt Qt binaries in C:\Qt\5.15.2\msvc2019_64\bin readPeExecutable: C:\Users\User\source\repos\qt5-temp\qBittorrent\build\qbittorrent.exe 64 bit, dependent libraries: 23, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Widgetsd.dll 64 bit, dependent libraries: 14 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5WinExtrasd.dll 64 bit, dependent libraries: 10 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Networkd.dll 64 bit, dependent libraries: 12 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Sqld.dll 64 bit, dependent libraries: 4 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Xmld.dll 64 bit, dependent libraries: 6 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 C:\Users\User\source\repos\qt5-temp\qBittorrent\build\qbittorrent.exe 64 bit, debug executable readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\bearer\qgenericbearerd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\bearer\qgenericbearerd.dll 64 bit, dependent libraries: 7 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Networkd.dll 64 bit, dependent libraries: 12 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\iconengines\qsvgicond.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\iconengines\qsvgicond.dll 64 bit, dependent libraries: 6 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Svgd.dll 64 bit, dependent libraries: 6 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Widgetsd.dll 64 bit, dependent libraries: 14 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 Adding Qt5Svg for qsvgicond.dll readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qgifd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qicnsd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qicod.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qjpegd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qsvgd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qtgad.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qtiffd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qwbmpd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qwebpd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qgifd.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qicnsd.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qicod.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qjpegd.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qsvgd.dll 64 bit, dependent libraries: 6 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Svgd.dll 64 bit, dependent libraries: 6 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Widgetsd.dll 64 bit, dependent libraries: 14 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qtgad.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qtiffd.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qwbmpd.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\imageformats\qwebpd.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\platforms\qwindowsd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\platforms\qwindowsd.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\sqldrivers\qsqlited.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\sqldrivers\qsqlodbcd.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\sqldrivers\qsqlpsqld.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\sqldrivers\qsqlited.dll 64 bit, dependent libraries: 5 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Sqld.dll 64 bit, dependent libraries: 4 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\sqldrivers\qsqlodbcd.dll 64 bit, dependent libraries: 6 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Sqld.dll 64 bit, dependent libraries: 4 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\sqldrivers\qsqlpsqld.dll 64 bit, dependent libraries: 7 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Sqld.dll 64 bit, dependent libraries: 4 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\styles\qwindowsvistastyled.dll 64 bit, debug readPeExecutable: C:\Qt\5.15.2\msvc2019_64\plugins\styles\qwindowsvistastyled.dll 64 bit, dependent libraries: 10 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Widgetsd.dll 64 bit, dependent libraries: 14 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Cored.dll 64 bit, dependent libraries: 16 Direct dependencies: Qt5Core Qt5Gui Qt5Network Qt5Sql Qt5Widgets Qt5WinExtras Qt5Xml All dependencies : Qt5Core Qt5Gui Qt5Network Qt5Sql Qt5Widgets Qt5WinExtras Qt5Xml To be deployed : Qt5Core Qt5Gui Qt5Network Qt5Sql Qt5Svg Qt5Widgets Qt5WinExtras Qt5Xml Plugins: C:/Qt/5.15.2/msvc2019_64/plugins/bearer/qgenericbearerd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/iconengines/qsvgicond.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qgifd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qicnsd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qicod.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qjpegd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qsvgd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qtgad.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qtiffd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qwbmpd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qwebpd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/platforms/qwindowsd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/sqldrivers/qsqlited.dll,C:/Qt/5.15.2/msvc2019_64/plugins/sqldrivers/qsqlodbcd.dll,C:/Qt/5.15.2/msvc2019_64/plugins/sqldrivers/qsqlpsqld.dll,C:/Qt/5.15.2/msvc2019_64/plugins/styles/qwindowsvistastyled.dll readPeExecutable: C:\Qt\5.15.2\msvc2019_64\bin\Qt5Guid.dll 64 bit, dependent libraries: 11 Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Cored.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Cored.dll Updating Qt5Cored.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Guid.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Guid.dll Updating Qt5Guid.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Networkd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Networkd.dll Updating Qt5Networkd.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Sqld.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Sqld.dll Updating Qt5Sqld.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Svgd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Svgd.dll Updating Qt5Svgd.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Widgetsd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Widgetsd.dll Updating Qt5Widgetsd.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5WinExtrasd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5WinExtrasd.dll Updating Qt5WinExtrasd.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/Qt5Xmld.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/Qt5Xmld.dll Updating Qt5Xmld.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/libGLESv2d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/libGLESv2d.dll Updating libGLESv2d.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/libEGLd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/libEGLd.dll Updating libEGLd.dll. Checking C:/Program Files (x86)/Windows Kits/10/Redist/D3D/x64/d3dcompiler_47.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/d3dcompiler_47.dll Updating d3dcompiler_47.dll. Checking C:/Qt/5.15.2/msvc2019_64/bin/opengl32sw.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/opengl32sw.dll Updating opengl32sw.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/concrt140d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/concrt140d.dll Updating concrt140d.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/msvcp140_1d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/msvcp140_1d.dll Updating msvcp140_1d.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/msvcp140_2d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/msvcp140_2d.dll Updating msvcp140_2d.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/msvcp140d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/msvcp140d.dll Updating msvcp140d.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/msvcp140d_atomic_wait.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/msvcp140d_atomic_wait.dll Updating msvcp140d_atomic_wait.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/msvcp140d_codecvt_ids.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/msvcp140d_codecvt_ids.dll Updating msvcp140d_codecvt_ids.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/vccorlib140d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/vccorlib140d.dll Updating vccorlib140d.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/vcruntime140_1d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/vcruntime140_1d.dll Updating vcruntime140_1d.dll. Checking C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/redist/MSVC/14.28.29910/Debug_NonRedist/x64/Microsoft.VC142.DebugCRT/vcruntime140d.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/vcruntime140d.dll Updating vcruntime140d.dll. Creating directory C:/Users/User/source/repos/qt5-temp/qBittorrent/build/bearer. Checking C:/Qt/5.15.2/msvc2019_64/plugins/bearer/qgenericbearerd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/bearer/qgenericbearerd.dll Updating qgenericbearerd.dll. Creating directory C:/Users/User/source/repos/qt5-temp/qBittorrent/build/iconengines. Checking C:/Qt/5.15.2/msvc2019_64/plugins/iconengines/qsvgicond.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/iconengines/qsvgicond.dll Updating qsvgicond.dll. Creating directory C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qgifd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qgifd.dll Updating qgifd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qicnsd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qicnsd.dll Updating qicnsd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qicod.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qicod.dll Updating qicod.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qjpegd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qjpegd.dll Updating qjpegd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qsvgd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qsvgd.dll Updating qsvgd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qtgad.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qtgad.dll Updating qtgad.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qtiffd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qtiffd.dll Updating qtiffd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qwbmpd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qwbmpd.dll Updating qwbmpd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/imageformats/qwebpd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/imageformats/qwebpd.dll Updating qwebpd.dll. Creating directory C:/Users/User/source/repos/qt5-temp/qBittorrent/build/platforms. Checking C:/Qt/5.15.2/msvc2019_64/plugins/platforms/qwindowsd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/platforms/qwindowsd.dll Updating qwindowsd.dll. Creating directory C:/Users/User/source/repos/qt5-temp/qBittorrent/build/sqldrivers. Checking C:/Qt/5.15.2/msvc2019_64/plugins/sqldrivers/qsqlited.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/sqldrivers/qsqlited.dll Updating qsqlited.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/sqldrivers/qsqlodbcd.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/sqldrivers/qsqlodbcd.dll Updating qsqlodbcd.dll. Checking C:/Qt/5.15.2/msvc2019_64/plugins/sqldrivers/qsqlpsqld.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/sqldrivers/qsqlpsqld.dll Updating qsqlpsqld.dll. Creating directory C:/Users/User/source/repos/qt5-temp/qBittorrent/build/styles. Checking C:/Qt/5.15.2/msvc2019_64/plugins/styles/qwindowsvistastyled.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/styles/qwindowsvistastyled.dll Updating qwindowsvistastyled.dll. Creating C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations... Creating qt_ar.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_ar.qm qtbase_ar.qm Creating qt_bg.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_bg.qm qtbase_bg.qm Creating qt_ca.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_ca.qm qtbase_ca.qm Creating qt_cs.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_cs.qm qtbase_cs.qm Creating qt_da.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_da.qm qtbase_da.qm Creating qt_de.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_de.qm qtbase_de.qm Creating qt_en.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_en.qm qtbase_en.qm Creating qt_es.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_es.qm qtbase_es.qm Creating qt_fi.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_fi.qm qtbase_fi.qm Creating qt_fr.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_fr.qm qtbase_fr.qm Creating qt_gd.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_gd.qm qtbase_gd.qm Creating qt_he.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_he.qm qtbase_he.qm Creating qt_hu.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_hu.qm qtbase_hu.qm Creating qt_it.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_it.qm qtbase_it.qm Creating qt_ja.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_ja.qm qtbase_ja.qm Creating qt_ko.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_ko.qm qtbase_ko.qm Creating qt_lv.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_lv.qm qtbase_lv.qm Creating qt_pl.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_pl.qm qtbase_pl.qm Creating qt_ru.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_ru.qm qtbase_ru.qm Creating qt_sk.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_sk.qm qtbase_sk.qm Creating qt_tr.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_tr.qm qtbase_tr.qm Creating qt_uk.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_uk.qm qtbase_uk.qm Creating qt_zh_TW.qm... Running: lconvert -o C:\Users\User\source\repos\qt5-temp\qBittorrent\build\translations\qt_zh_TW.qm qtbase_zh_TW.qm ```
Neumann-A commented 3 years ago

Checking C:/vcpkg/installed/x64-windows/bin/libGLESv2.dll, C:/Users/User/source/repos/qt5-temp/qBittorrent/build/libGLESv2.dll C:\vcpkg\installed\x64-windows\bin\libGLESv2.dll does not exist.

Need to install angle or mesa to have this file available. Is there an option -no-angle|-no-opengl for qt5 windeployqt?

The debug problem is basically known since I cannot install two different qt.confs and use both without some hacks or extra batch scripts.

FranciscoPombal commented 3 years ago

@Neumann-A

Need to install angle or mesa to have this file available. Is there an option -no-angle|-no-opengl for qt5 windeployqt?

Thanks, you are right. No luck with mesa, but the files were indeed found after installing angle. Alternatively, passing either --no-angle (predictably) or --ignore-library-errors (maybe not so predictably) also worked fine. So there is no problem with Release configs (I will edit the OP to reflect that).

The debug problem is basically known since I cannot install two different qt.confs and use both without some hacks or extra batch scripts.

Is a solution like the one implemented for the Qt6 port not possible?

FranciscoPombal commented 3 years ago

@Neumann-A

Need to install angle or mesa to have this file available. Is there an option -no-angle|-no-opengl for qt5 windeployqt?

Actually, doesn't this mean that Qt5 should depend on angle, at least on x64-windows (and possibly other triplets as well, some testing would be required to figure that out)?

Neumann-A commented 3 years ago

Is a solution like the one implemented for the Qt6 port not possible?

Yeah the same solution is probably possible but I consider Qt5 dead considering 5.15.4 has already been commercially released

Actually, doesn't this mean that Qt5 should depend on angle, at least on x64-windows (and possibly other triplets as well, some testing would be required to figure that out)?

There was already a discussion about that. Qt5 does not require angle neither as a runtime dependency nor as a build time dependency. It is an purely optional runtime dependency and deploying with angle or not is simply up to the user and the system the user wants to support. I mean there is a reason why it has been removed from the Qt6 deployment.

vserdyuk commented 2 years ago

The port now has some workaround scripts to address the issue:

These are installed to installed\x64-windows\tools\Qt6\bin directory. You can edit your build script calling windeployqt.exe to call windeployqt.debug.bat in debug configuration.

EDIT: this is for the most recent Qt port (without number) which now has Qt 6. Although, I think the same approach can be applied to qt5 port too.

dg0yt commented 2 years ago

The port now has some workaround scripts to address the issue:

@vserdyuk You are pointing at Qt 6 but the issue is for Qt 5.

vserdyuk commented 2 years ago

Reference

Sorry, didn't notice this. The issue is the only relevant search result for the problem. Edited my first reply.

Philaeux commented 2 years ago

I had the same issue today, impossible to use windeployqt with DEBUG configuration. Root issue: the debug DLL is not available in vcpkg/installed/x64-windows/bin/ while the RELEASE DLL is available. Use the windeployqt.debug.bat as specified by vserdyuk for DEBUG configuration.

Long story:
I recently tried to use: vcpkg + visual studio + cmake + Qt.
I started a simple Visual studio CMake repository => no issue in Release/Debug.
I then used vcpkg to install sqlite3:x64-windows and used it in the repository => no issue in Release/Debug.
I then used vcpkg to install qtbase:x64-windows and used it in the repository, and issues appear.

After finding this thread, I found the windeployqt.debug.bat inside the same directory as windeployqt, which works for DEBUG. I think the Qt port should display in the installation message that you have to use this bat in debug and the normal tool in release. Might save some time for other devs.

Neumann-A commented 2 years ago

If you already use cmake than please use the windeploy target qt exports. That automatically switches between the two files.

Philaeux commented 2 years ago

In DEBUG and RELEASE, it is calling the corresponding windeploy by default. But some files are missing. Using this basic CMakeLists.txt:

cmake_minimum_required (VERSION 3.19)
project("prellex" VERSION 0.1.0 LANGUAGES CXX)

find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets)

qt_standard_project_setup() 
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

qt_add_executable(main "prellex/main.cpp")
set_target_properties(main PROPERTIES windeploy TRUE)

target_link_libraries(main PRIVATE unofficial::sqlite3::sqlite3)
target_link_libraries(main PRIVATE Qt::Widgets)

I get this output: image While executing windeployqt.debug.bat gives me this output: image I must be missing a flag somewhere in the cmake file. I am missing D3D DLL and all the directories.

julianxhokaxhiu commented 1 year ago

May I ask how am I supposed to setup my CMakeLists.txt to ensure windeployqy is being called automatically on each build/install? Following the example here leads me to the first screenshot result, but I need the second one as an outcome. Any help is appreciated. Thank you!

MonicaLiu0311 commented 1 year ago

@JackBoosY Please take a look at this issue.

JackBoosY commented 1 year ago

@JackBoosY Please take a look at this issue.

😂 I can do nothing about this issue.

vserdyuk commented 1 year ago

May I ask how am I supposed to setup my CMakeLists.txt to ensure windeployqy is being called automatically on each build/install? Following the example here leads me to the first screenshot result, but I need the second one as an outcome. Any help is appreciated. Thank you!

Here's a slightly modified code we use, based on https://stackoverflow.com/a/60856725. Checked for Qt 6, not sure if qtpaths.debug.bat was added to Qt 5 vcpkg port.

find_package(QT NAMES Qt6 Qt5 REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)

if(WIN32)
    function(windeployqt TARGET_NAME QML_DIR)
        get_target_property(QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
        get_filename_component(QT_BIN_DIR "${QMAKE_EXECUTABLE}" DIRECTORY)

        get_target_property(QTCORE_DEBUG_DLL Qt${QT_VERSION_MAJOR}::Core IMPORTED_LOCATION_DEBUG)
        get_filename_component(QTCORE_DEBUG_DIR "${QTCORE_DEBUG_DLL}" DIRECTORY)

        if(QT_VERSION_MAJOR GREATER_EQUAL 6)
            set(NO_OPENGL_ARG "")
        else()
            set(NO_OPENGL_ARG "--no-opengl")
        endif()

        if(EXISTS ${QT_BIN_DIR}/qtpaths.debug.bat)
            set(QPATHS_DEBUG_ARG "--qtpaths \"${QT_BIN_DIR}/qtpaths.debug.bat\"")
        endif()

        add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E env "PATH=$<$<CONFIG:Debug>:${QTCORE_DEBUG_DIR};>$ENV{PATH}"
            "${QT_BIN_DIR}/windeployqt.exe"
            #--verbose 1
            --verbose 0
            $<IF:$<CONFIG:Debug>,--debug,--release>
            --no-svg
            # ANGLE is required for OpenGL over RDP, see:
            # https://wiki.qt.io/Qt_5_on_Windows_ANGLE_and_OpenGL
            # https://stackoverflow.com/questions/51705471/current-state-and-solutions-for-opengl-over-windows-remote
            # So we need libEGLd.dll, that's why we don't pass --no-angle
            ${NO_OPENGL_ARG}
            --no-opengl-sw
            --no-compiler-runtime
            --no-system-d3d-compiler
            --qmldir "${QML_DIR}"
            $<$<CONFIG:Debug>:${QPATHS_DEBUG_ARG}>
            \"$<TARGET_FILE:${TARGET_NAME}>\"
            COMMENT "Deploying Qt libraries using windeployqt for compilation target '${TARGET_NAME}' ...")
    endfunction()
endif()

Call this function e.g. this way:

get_target_property(MYAPP_SOURCE_DIR myapp SOURCE_DIR)
include(windeployqt.cmake)
windeployqt(myapp ${MYAPP_SOURCE_DIR})
julianxhokaxhiu commented 1 year ago

Thanks @vserdyuk sorry I forgot to reply to this issue that in the end I figured it out. But I found another issue as part of this deployment process. It seems Qt is not statically linked against its own dependencies and there are some libraries requires when deploying a Qt built app. See this issue more info: https://github.com/microsoft/vcpkg/issues/21044#issuecomment-1219200232

I did try to built my project using the triplet x64-windows-static but it ends up having issues linking statically some parts of the QtQuick ( I don't have the error at hand atm but it was weird as the MSVC linker was saying that it couldn't find an object file while the file was actually there on the disk at the looked path ). Anyway, I guess this is an issue on its own.

kwsp commented 1 year ago

The port now has some workaround scripts to address the issue:

  • ports\qtbase\windeployqt.debug.bat
  • ports\qtbase\qtpaths.debug.bat (called by above)

This script works very well for me!

larixsoft commented 1 year ago

The port now has some workaround scripts to address the issue:

  • ports\qtbase\windeployqt.debug.bat
  • ports\qtbase\qtpaths.debug.bat (called by above)

These are installed to installed\x64-windows\tools\Qt6\bin directory. You can edit your build script calling windeployqt.exe to call windeployqt.debug.bat in debug configuration.

EDIT: this is for the most recent Qt port (without number) which now has Qt 6. Although, I think the same approach can be applied to qt5 port too.

I'm using Qt5 installed from vcpkg, and copied these two .bat files to installed\x64-windows\tools\qt5-tools\bin, but it didn't work. it complained "Unknown option 'qtpaths'."

I don't think windeployqt.exe supports this qtpaths option. my vcpkg information.

C:\vcpkg>git log commit 5b1214315250939257ef5d62ecdcbca18cf4fb1c (HEAD -> master, origin/master, origin/HEAD) Author: Billy O'Neal bion@microsoft.com Date: Thu Mar 30 12:02:53 2023 -0700

Update vcpkg-tool to 2023-03-29. (#30503)
larixsoft commented 1 year ago

The port now has some workaround scripts to address the issue:

  • ports\qtbase\windeployqt.debug.bat
  • ports\qtbase\qtpaths.debug.bat (called by above)

This script works very well for me!

Hi @kwsp what's your qt's version? when I run these .bat file, it complains "Unknown option 'qtpaths'." thanks.

kwsp commented 1 year ago

The port now has some workaround scripts to address the issue:

  • ports\qtbase\windeployqt.debug.bat
  • ports\qtbase\qtpaths.debug.bat (called by above)

This script works very well for me!

Hi @kwsp what's your qt's version? when I run these .bat file, it complains "Unknown option 'qtpaths'." thanks.

I use the latest Qt 6 from vcpkg.

midrare commented 8 months ago

I figured it out. This is all caused by vcpkg putting windeployqt.exe in the tools dir.

From the docs:

The tool can be found in QTDIR/bin/windeployqt.

This is where it's supposed to be, and where it assumes it still is. Proof: Copy all Qt*.dll files into the tools dir where windeployqt.exe currently is, and everything works.

This also explains why Release works but Debug doesn't: the tools dir contains all the release dlls but not the debug dlls. The fact that windeployqt.exe works with Release is only an accident. It's actually copying dlls from the tools dir instead of the bin dir like it's supposed to. Proof: delete all Qt*.dll files from the bin dir and deploy in Release mode. Qt dlls are still copied, even though they were deleted from the bin dir.

Solution: put windeployqt.exe back in bin. Or copy all Qt dlls including debug into tools dir.


Also, qtbase has the same issue https://github.com/microsoft/vcpkg/issues/36250 so qtbase should be fixed as well.

Neumann-A commented 8 months ago

Use the cmake target instead the program directly ! vcpkg has windeployqt.debug.bat for qt6

dg0yt commented 8 months ago

This issue is labeled "[qt5]". Anything else is off-topic.

midrare commented 8 months ago

@Neumann-A I'm linking to the CMake target and using qt_generate_deploy_app_script(). Full code at https://github.com/microsoft/vcpkg/issues/36250

@dg0yt I tried opening a separate issue for [qtbase] at https://github.com/microsoft/vcpkg/issues/36250 but it was closed as a dupe of this one. I don't know what I'm supposed to do here.

dg0yt commented 8 months ago

@midrare Complain to @jimwang118. No qt6 in this issue.

vserdyuk commented 8 months ago

~~Probably broken by https://github.com/microsoft/vcpkg/commit/5b60a7a1059573784f998ca470c4ce9fa0cfdf3d. Commit 2b14b606cea54573eec11080a3ac00737958b6d6 (version 6.6.0) works for me. Stopped working after merging from recent upstream.~~ Edit: sorry, again I replied to the wrong thread.