Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qtbase] windeployqt can't be found with find_program without hints #43111

Open
Bobini1 opened this issue Jan 5, 2025 · 5 comments
Open

[qtbase] windeployqt can't be found with find_program without hints #43111

Bobini1 opened this issue Jan 5, 2025 · 5 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@Bobini1
Copy link

Bobini1 commented Jan 5, 2025

Operating system

Windows 10

Compiler

MSVC

Steps to reproduce the behavior

Create a CMake project, for example with the cmake-init tool.
Add qtbase and qttools 6.8.1 as dependencies in vcpkg.json.

find_program(TOOL_WINDEPLOYQT NAMES windeployqt)
find_program(TOOL_WINDEPLOYQT_DEBUG NAMES windeployqt.debug.bat)
message(STATUS "TOOL_WINDEPLOYQT:${TOOL_WINDEPLOYQT} ${TOOL_WINDEPLOYQT_DEBUG}")
-- TOOL_WINDEPLOYQT:TOOL_WINDEPLOYQT-NOTFOUND TOOL_WINDEPLOYQT_DEBUG-NOTFOUND

If I do this, it works, but it wasn't necessary before:

find_program(WINDEPLOYQT_EXECUTABLE NAMES windeployqt HINTS "${CMAKE_BINARY_DIR}/vcpkg_installed/x64-windows/tools/Qt6/bin")

Failure logs

C:\Users\PC\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe --preset dev -S M:\vcpkg-windeployqt-failure -B M:\vcpkg-windeployqt-failure\build\dev
Preset CMake variables:

  BUILD_MCSS_DOCS="ON"
  CMAKE_CXX_EXTENSIONS="OFF"
  CMAKE_CXX_FLAGS="/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc"
  CMAKE_CXX_STANDARD="17"
  CMAKE_CXX_STANDARD_REQUIRED="ON"
  CMAKE_EXE_LINKER_FLAGS="/machine:x64 /guard:cf"
  CMAKE_TOOLCHAIN_FILE="M:\v/scripts/buildsystems/vcpkg.cmake"
  VCPKG_MANIFEST_FEATURES="test"
  VCPKG_TARGET_TRIPLET="x64-windows-static-md"
  vcpkg-windeployqt-failure_DEVELOPER_MODE="ON"

Preset environment variables:

  EnforceProcessCountAcrossBuilds="true"
  UseMultiToolTask="true"

-- Running vcpkg install
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe
Detecting compiler hash for triplet x64-windows-static-md...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe
All requested packages are currently installed.
Total install time: 900 ns
The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

qtbase provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(Qt6 CONFIG REQUIRED)
  # note: 37 additional targets are not displayed.
  target_link_libraries(main PRIVATE DB2::DB2 PPS::PPS Oracle::OCI Libb2::Libb2)

  find_package(Qt6Concurrent CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::Concurrent Qt6::ConcurrentPrivate)

  find_package(Qt6Core CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::Core Qt6::CorePrivate)

  find_package(Qt6DeviceDiscoverySupportPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::DeviceDiscoverySupportPrivate)

  find_package(Qt6EntryPointPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::EntryPointPrivate Qt6::EntryPointImplementation)

  find_package(Qt6ExampleIconsPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::ExampleIconsPrivate Qt6::ExampleIconsPrivate_resources_1)

  find_package(Qt6ExamplesAssetDownloaderPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::ExamplesAssetDownloaderPrivate)

  find_package(Qt6FbSupportPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::FbSupportPrivate)

  find_package(Qt6Gui CONFIG REQUIRED)
  # note: 20 additional targets are not displayed.
  target_link_libraries(main PRIVATE Qt6::Gui Qt6::GuiPrivate Qt6::QGifPlugin Qt6::QICOPlugin)

  find_package(Qt6Network CONFIG REQUIRED)
  # note: 6 additional targets are not displayed.
  target_link_libraries(main PRIVATE Qt6::Network Qt6::QNLMNIPlugin Qt6::NetworkPrivate Qt6::QNLMNIPlugin_init)

  find_package(Qt6OpenGL CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::OpenGL Qt6::OpenGLPrivate)

  find_package(Qt6OpenGLWidgets CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::OpenGLWidgets Qt6::OpenGLWidgetsPrivate)

  find_package(Qt6PrintSupport CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::PrintSupport Qt6::PrintSupportPrivate Qt6::PrintSupport_resources_1 Qt6::PrintSupport_resources_2)

  find_package(Qt6Sql CONFIG REQUIRED)
  # note: 2 additional targets are not displayed.
  target_link_libraries(main PRIVATE Qt6::Sql Qt6::SqlPrivate Qt6::QPSQLDriverPlugin Qt6::QSQLiteDriverPlugin)

  find_package(Qt6Test CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::Test Qt6::TestPrivate)

  find_package(Qt6Widgets CONFIG REQUIRED)
  # note: 4 additional targets are not displayed.
  target_link_libraries(main PRIVATE Qt6::Widgets Qt6::WidgetsPrivate Qt6::Widgets_resources_1 Qt6::Widgets_resources_2)

  find_package(Qt6Xml CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::Xml Qt6::XmlPrivate)

qttools provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(Qt6QDocCatchConversionsPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::QDocCatchConversionsPrivate)

  find_package(Qt6QDocCatchGeneratorsPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::QDocCatchGeneratorsPrivate)

  find_package(Qt6QDocCatchPrivate CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::QDocCatchPrivate)

  find_package(Qt6Tools CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::Tools)

  find_package(Qt6UiPlugin CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::UiPlugin)

  find_package(Qt6UiTools CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Qt6::UiTools Qt6::UiToolsPrivate)

catch2 provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(Catch2 CONFIG REQUIRED)
  target_link_libraries(main PRIVATE Catch2::Catch2 Catch2::Catch2WithMain)

catch2 provides pkg-config modules:

  # A modern, C++-native test framework for C++14 and above (links in default main)
  catch2-with-main

  # A modern, C++-native, test framework for C++14 and above
  catch2

-- Running vcpkg install - done
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.19045.
-- Windeployqt: WINDEPLOYQT_EXECUTABLE-NOTFOUND
-- Configuring done (6.2s)
-- Generating done (0.1s)
-- Build files have been written to: M:/vcpkg-windeployqt-failure/build/dev

[Finished]

Additional context

I used to invoke windeployqt in my build folder to be able to easily run my application without installing the program. It stopped working, my CMake scripts can't find windeployqt, even though it is in vcpkg_installed.

@Bobini1 Bobini1 added the category:port-bug The issue is with a library, which is something the port should already support label Jan 5, 2025
@Bobini1
Copy link
Author

Bobini1 commented Jan 6, 2025

The problem seems to go away when the host triplet is the same as the target triplet.

@Bobini1
Copy link
Author

Bobini1 commented Jan 6, 2025

In fact, I don't think windeployqt works at all, even in the install script. It can't find libraries. I feel it might have something to do with the host-target split.

@Bobini1
Copy link
Author

Bobini1 commented Jan 6, 2025

I changed the host triplet to be the same as the target triplet and everything worked like before.

@dg0yt
Copy link
Contributor

dg0yt commented Jan 6, 2025

Note that by default, vcpkg does not pass the host triplet into cmake configuration.
Without that parameter, the vcpkg toolchain points CMAKE_PROGRAM_PATH to the target tools dir, not to the host tools dir.

Isn't windeployqt available as an imported target? If yes, doesn't it point to the right location?

@Bobini1
Copy link
Author

Bobini1 commented Jan 6, 2025

@dg0yt It is not available as an imported property. I can't find it, at least.

This is my CMAKE_PROGRAM_PATH:
M:/vcpkg-windeployqt-failure/build/dev/vcpkg_installed/x64-windows-static-md/tools;M:/vcpkg-windeployqt-failure/build/dev/vcpkg_installed/x64-windows-static-md/tools/brotli;M:/vcpkg-windeployqt-failure/build/dev/vcpkg_installed/x64-windows-static-md/tools/bzip2;M:/vcpkg-windeployqt-failure/build/dev/vcpkg_installed/x64-windows-static-md/tools/pcre2;M:/vcpkg-windeployqt-failure/build/dev/vcpkg_installed/x64-windows-static-md/tools/Qt6/bin;M:/vcpkg-windeployqt-failure/build/dev/vcpkg_installed/x64-windows-static-md/tools/icu/bin

As you can see, none of those paths point to the host tools dir (x64-windows). They are all target dirs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

No branches or pull requests

3 participants