Vcpkg: [qt5-base] Incorrect target properties for debug builds in CMake configs (x64-osx)

Created on 2 Feb 2020  路  3Comments  路  Source: microsoft/vcpkg

Describe the bug
The target and plugin properties in the CMake config files for referencing the library filename do not match the actual filename on disk for the triplet x64-osx. When linking against a Qt5 target via CMake, this results in an error message, that the file does not exist.

The portfile.cmake currently removes the debug-specific config files and the script fixcmake.py does not correctly update the release-specific one for the Qt5 macOS build. Qt5 on macOS adds the postfix _debug to all files.

Environment

  • OS: macOS 10.15
  • Compiler: Apple clang version 11.0.0 (clang-1100.0.33.12)

To Reproduce
Steps to reproduce the behavior:

  1. ./vcpkg install qt5-base
  2. Compare filename of debug libraries against CMake config files, e.g., for Qt5Core:
$ ls installed/x64-osx/debug/lib/libQt5Core_debug.a
installed/x64-osx/debug/lib/libQt5Core_debug.a
$ grep "libQt5Core" installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake
    _populate_Core_target_properties(RELEASE "libQt5Core.a" "" )
    _populate_Core_target_properties(DEBUG "libQt5Core.a" "" )
  1. Verify against original debug-specific config files, e.g., for Qt5Core:
$ grep "libQt5Core" buildtrees/qt5-base/x64-osx-dbg/lib/cmake/Qt5Core/Qt5CoreConfig.cmake 
    _populate_Core_target_properties(DEBUG "libQt5Core_debug.a" "" )

Expected behavior
The target and plugin properties in all Qt5 CMake config files should match the actual filename on disk, e.g., the correct entry for target properties in installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake should be:

    _populate_Core_target_properties(DEBUG "libQt5Core_debug.a" "" )

and the correct entry for plugin properties, e.g., in installed/x64-osx/share/cmake/Qt5Gui/Qt5Gui_QCocoaIntegrationPlugin.cmake should be:

_populate_Gui_plugin_properties(QCocoaIntegrationPlugin DEBUG "platforms/libqcocoa_debug.a")

Failure logs
CMake error when trying to link against target Qt5::Core after using find_package():

CMake Error at /Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
  The imported target "Qt5::Core" references the file

     "/Users/test/vcpkg/installed/x64-osx/debug/lib/libQt5Core.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake:35 (_qt5_Core_check_file_exists)
  /Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5Core/Qt5CoreConfig.cmake:156 (_populate_Core_target_properties)
  /Users/test/vcpkg/installed/x64-osx/share/qt5core/vcpkg-cmake-wrapper.cmake:1 (_find_package)
  /Users/test/vcpkg/scripts/buildsystems/vcpkg.cmake:240 (include)
  /Users/test/vcpkg/installed/x64-osx/share/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  /Users/test/vcpkg/scripts/buildsystems/vcpkg.cmake:285 (_find_package)
  CMakeLists.txt:129 (find_package)
port-bug

Most helpful comment

I've just tested a build with #9705 on x64-osx and that seems to fix this issue.

All 3 comments

should already be fixed in #9705 since I remove the fixcmake.py script and patched the config.in instead. The python script was just too fragile and it seemed to never really work for all cases.

I've just tested a build with #9705 on x64-osx and that seems to fix this issue.

@JackBoosY: this can be closed.

Was this page helpful?
0 / 5 - 0 ratings