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

qt_deploy_runtime_dependencies() doesn't install project linked libraries & adds undocumented vcredist installer

    XMLWordPrintable

Details

    • Windows
    • e7b8b7bfb (dev), 0a0f77782 (dev), fa34315a5 (6.5), 50cff47d1 (6.5), 3b234eefe (dev), 784add8a6 (6.5)

    Description

      Just getting into deploying packages with shared libraries so I figured I'd give qt_generate_deploy_app_script() a go:

       

      qt_generate_deploy_app_script(
          TARGET "MyExecuteable"
          FILENAME_VARIABLE qt_runtime_deploy_script
          NO_UNSUPPORTED_PLATFORM_ERROR
      )
      install(SCRIPT ${qt_runtime_deploy_script})
      
      

       

      This is a list of the executable target's list of links:

      PRIVATE
          STAR::Base
          Qt6::Core
          Qx::Core
          Qx::Io 

      and this is a list of STAR:Base's (which is a lib that is also part of the project) own links:

      PRIVATE    
          Qx::Core
          Qx::Io
      PUBLIC
          Qt6::Core

      Qx is external to the project, but brought in via add_subdirectory() (FetchContent) so from CMake's perspective it is part of the build tree. It has no other dependencies in this case other than Qt6:Core.

       

      The documentation for qt_deploy_runtime_dependencies() states:

      It will install non-system libraries (both Qt and those provided by the project), plus an appropriate set of Qt plugins.

      which I interpret as meaning it will install all runtime dependencies contributed by all of the targets that the provided target is linked to (Qt or not), except for system libraries.

      Therefore, I expect the bin directory on Windows at the end of installation to contain the following:

      MyExecutable.exe
      STARBase.dll
      QxCore.dll
      QxIo.dll
      Qt6Core.dll
      qt.conf

      however, I instead find the following:

      MyExecutable.exe
      Qt6Core.dll
      qt.conf
      vc_redist.x64.exe

      There are also a number of Visual C++ redistributable related DLLs installed if I build in a Debug configuration:

      concrt140d.dll
      msvcp140_1d.dll
      msvcp140_2d.dll
      msvcp140d.dll
      msvcp140d_atomic_wait.dll
      msbcp140d_codecvt_ids.dll

      though perhaps this isn't an issue since mainly you run deployment for Release builds.

       

      Anyway, the first issue:

      The libraries in the project that MyExecuteable links to are not installed.

      I wonder if this is because the generated script is only checking IMPORTED targets, similar to how CMake's own install(TARGETS ... RUNTIME_DEPENDENCIES) purposely blacklists targets that are part of the current build tree. This would be unfortunate given I'm explicitly trying to avoid that behavior as I'm not installing the libs here directly since they are only built as dependencies, and so I want them to be installed as such (i.e. only their runtime binaries) without having to explicitly install them.

      Or maybe it's just a bug.

       

      The second issue:

      Please add a switch argument to qt_generate_deploy_app_script() that makes the Visual C/C++ Redistributable installer opt-in (or at least one that let's you opt out) as I don't want that distributed as part of my core package. This is also nearly equivalent to "installing a system library" which contradicts the documentation.

      EDIT:

      Attached MRE. Build and install. In any configuration, test_lib.dll is not copied to CMAKE_INSTALL_PREFIX/bin, and in Release configuration vc_redist.x64.exe is installed there without an option to disable it.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            oblivioncth Chris Heimlich
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: