microsoft / vcpkg

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

[qt] Querying qmake for QT_INSTALL_TRANSLATIONS returns an incorrect path #40506

Open davidebeatrici opened 4 weeks ago

davidebeatrici commented 4 weeks ago

Describe the bug

Querying qmake for QT_INSTALL_TRANSLATIONS returns a path containing the base triplet (e.g. x64-osx) instead of the precise one (e.g. x64-osx-release).

This issue may be be macOS-specific because I didn't encounter it on Windows.

Environment

To Reproduce

Steps to reproduce the behavior:

  1. ./vcpkg install qtbase:x64-osx-release
  2. Query qmake for QT_INSTALL_TRANSLATIONS, example CMake code:

    # Get the path to the qmake executable
    get_target_property(QT_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION)
    
    # Query qmake for the location of the installed Qt translations
    execute_process(
        COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS
        OUTPUT_VARIABLE QUERY_RESULT
    )
    
    string(STRIP "${QUERY_RESULT}" QUERY_RESULT)
    
    message(STATUS "${QUERY_RESULT}")
  3. Observe the resulting value (path) containing x64-osx rather than x64-osx-release.

Expected behavior

The variable should point to the correct directory that contains Qt's translations.

Failure logs

-- Qt6 component found: LinguistTools | Version: 6.7.2
-- Bundling Qt translations from "/Users/runner/hostedtoolcache/MumbleBuild/mumble_env.x64-osx-release.2024-08-15.9ad0398d8/installed/x64-osx/translations/Qt6"
-- Found Python interpreter version 3.11.8
Traceback (most recent call last):
  File "/Users/runner/work/1/s/scripts/generate-mumble_qt-qrc.py", line 145, in <module>
    main()
  File "/Users/runner/work/1/s/scripts/generate-mumble_qt-qrc.py", line 137, in main
    processedComponents.extend(dirToQrc(of, dirName, processedComponents))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/runner/work/1/s/scripts/generate-mumble_qt-qrc.py", line 78, in dirToQrc
    fileNames = os.listdir(absPath)
                ^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/runner/hostedtoolcache/MumbleBuild/mumble_env.x64-osx-release.2024-08-15.9ad0398d8/installed/x64-osx/translations/Qt6'
CMake Error at cmake/qt-utils.cmake:150 (message):
  generate-mumble_qt-qrc.py returned exit code 1
Call Stack (most recent call first):
  src/mumble/CMakeLists.txt:845 (bundle_qt_translations)
davidebeatrici commented 4 weeks ago

Passing --host-triplet=x64-osx-release when installing the port(s) fixes the issue and the x64-osx directory is not created at all.