Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-139273

Copy wrong release qml dlls, when installing debug build with cmake and vcpkg

XMLWordPrintable

    • Windows

      I'm trying to use vcpkg with cmake to resolve `qtdeclarative` package dependency in manifest mode. When I try to run `cmake --install` in debug config, it copys release qml dlls into <install_dir>/qml/ directory. This also results that the dependent <install_dir>/plugin/ directory cannot be resolved properly. Its worth noting that when installing release build it works properly, because `QtInstallPaths.cmake`  records the right path for qt release depencency but not for debug one, which is in <qt_path>/debug/... according to vcpkg package layout.

      I try to solve the debug dll issue by following the path resolving process, hope the process below to be useful for you:

      1. cmake configure:
        1. `find_package(Qt6...)`: it reads `QtInstallPaths.cmake` and get package layout directory variables, `<qt_path>` for `QT6_INSTALL_PREFIX` and `Qt6/qml` for `QT6_INSTALL_QML`
        2. `qt_add_executable(<target>)`: it adds a task named `<target> finalize` to be executed after cmake configure process
        3. `<target> finalize`:  it generates a file at `<cmake_build_dir>/<target>/.qt/qml_imports/<target>_build.rsp`. The `-importPath` part in this file includes a entry named `QT6_INSTALL_PREFIX/QT6_INSTALL_QML`, that is __ `<qt_path>/Qt6/qml`, which is the right path for release qml depencency not for debug.
      2. cmake build: generates `<cmake_build_dir>/<target>/.qt/qml_imports/<target>_build.cmake`, using the release qml path
      3. cmake install:
        1. runs `qt6_deploy_qml_imports` using the 2. <target>_build.cmake file, and copys the wrong release qml dlls into `<cmake_install_dir>/qml/...` 
        2. `qt6_deploy_runtime_dependencies`: cannt resolve copied release qml dlls dependencies. No `<cmake_install_dir>/plugin/...` dlls is copied.

      > BTW, I cannt run the exe target in an IDE(VS) without installing, too. It's acceptable for me to get the installing issue solved first, but I still wonder how can i resolve qt dependency when running the exe target without installing?

       

      Update: I modified the calqlatr example in qt quick examples to a vcpkg project. Maybe you can replecate this issue by

      # $env:VCPKG_ROOT="<your_vcpkg_root>"
      set VCPKG_ROOT=<your_vcpkg_root>
      cd calqlatr
      cmake . --preset=vcpkg
      cd build/vcpkg
      cmake --build .
      cmake --install .

       

        For Gerrit Dashboard: QTBUG-139273
        # Subject Branch Project Status CR V

            qtbuildsystem Qt Build System Team
            ciue ciue 6a6
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change