Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. windeployqt.exe looks for library in the wrong place
Forum Updated to NodeBB v4.3 + New Features

windeployqt.exe looks for library in the wrong place

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
12 Posts 3 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by Mesrine
    #1

    Hi everyone.

    I have a console application and I use cmake-deployment-api to deploy the qt dependencies.
    This works well for linux and macos,but not for windows.
    For windows the cmake install step

    Run cmake --install .
    

    returns

    ...
    -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttConfigVersionImpl.cmake
    -- Installing: D:/a/_temp/install/lib/Qt6Mqtt.lib
    -- Installing: D:/a/_temp/install/bin/Qt6Mqtt.dll
    -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttTargets.cmake
    -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttTargets-release.cmake
    -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttVersionlessTargets.cmake
    -- Installing: D:/a/_temp/install/./modules/Mqtt.json
    ...
    -- Running Qt deploy tool for D:/a/_temp/build/outConsolidator.exe in working directory 'D:/a/_temp/install'
    'D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/bin/windeployqt.exe' 'D:/a/_temp/build/outConsolidator.exe' '--dir' '.' '--libdir' 'bin' '--plugindir' 'plugins' '--force'
    Unable to find dependent libraries of D:\a\outConsolidator\Qt\6.6.0\msvc2019_64\bin\Qt6Mqtt.dll :Cannot open 'D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/bin/Qt6Mqtt.dll': The system cannot find the file specified.
    CMake Error at D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:475 (message):
      Executing D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/bin/windeployqt.exe
      failed: 1
    Call Stack (most recent call first):
      .qt/deploy_outConsolidator_67a0058dfd.cmake:5 (qt6_deploy_runtime_dependencies)
      cmake_install.cmake:71 (include)
    

    The thing is I have not installed QtMqtt as part of Qt installation.

    My CMake project downloads and build Qt6Mqtt.dll.
    My project also install the library as shown on the cmake install step above in D:/a/_temp/install/bin/Qt6Mqtt.dll.

    So, It seems windeployqt.exe detects that the application depends on Qt6Mqtt.dll but it is looking at the bin folder of the Qt installation directory.

    Interestingly I also have a qtquick application that uses the same libraries and cmake-deployment-api.
    But there everything works well.

    So any help clarifying why windeployqt.exe gives that error and how to fix it will be much appreciated.

    Christian EhrlicherC 1 Reply Last reply
    0
    • MesrineM Mesrine

      Hi everyone.

      I have a console application and I use cmake-deployment-api to deploy the qt dependencies.
      This works well for linux and macos,but not for windows.
      For windows the cmake install step

      Run cmake --install .
      

      returns

      ...
      -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttConfigVersionImpl.cmake
      -- Installing: D:/a/_temp/install/lib/Qt6Mqtt.lib
      -- Installing: D:/a/_temp/install/bin/Qt6Mqtt.dll
      -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttTargets.cmake
      -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttTargets-release.cmake
      -- Installing: D:/a/_temp/install/lib/cmake/Qt6Mqtt/Qt6MqttVersionlessTargets.cmake
      -- Installing: D:/a/_temp/install/./modules/Mqtt.json
      ...
      -- Running Qt deploy tool for D:/a/_temp/build/outConsolidator.exe in working directory 'D:/a/_temp/install'
      'D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/bin/windeployqt.exe' 'D:/a/_temp/build/outConsolidator.exe' '--dir' '.' '--libdir' 'bin' '--plugindir' 'plugins' '--force'
      Unable to find dependent libraries of D:\a\outConsolidator\Qt\6.6.0\msvc2019_64\bin\Qt6Mqtt.dll :Cannot open 'D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/bin/Qt6Mqtt.dll': The system cannot find the file specified.
      CMake Error at D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:475 (message):
        Executing D:/a/outConsolidator/Qt/6.6.0/msvc2019_64/bin/windeployqt.exe
        failed: 1
      Call Stack (most recent call first):
        .qt/deploy_outConsolidator_67a0058dfd.cmake:5 (qt6_deploy_runtime_dependencies)
        cmake_install.cmake:71 (include)
      

      The thing is I have not installed QtMqtt as part of Qt installation.

      My CMake project downloads and build Qt6Mqtt.dll.
      My project also install the library as shown on the cmake install step above in D:/a/_temp/install/bin/Qt6Mqtt.dll.

      So, It seems windeployqt.exe detects that the application depends on Qt6Mqtt.dll but it is looking at the bin folder of the Qt installation directory.

      Interestingly I also have a qtquick application that uses the same libraries and cmake-deployment-api.
      But there everything works well.

      So any help clarifying why windeployqt.exe gives that error and how to fix it will be much appreciated.

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      windeployqt (as also qmake and the cmake scripts) expects that all Qt stuff is innstalled with the same prefix which is not in your case.
      So install the Qt6Mqtt stuff with the same prefix as the rest.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      MesrineM 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        windeployqt (as also qmake and the cmake scripts) expects that all Qt stuff is innstalled with the same prefix which is not in your case.
        So install the Qt6Mqtt stuff with the same prefix as the rest.

        MesrineM Offline
        MesrineM Offline
        Mesrine
        wrote on last edited by Mesrine
        #3

        @Christian-Ehrlicher

        Thanks, do you know how to install Qt6Mqtt on a GitHub runner?
        And how it is that works for the qtquick application and not for the console application.
        For the qtquick application, Qt6Mqtt is not installed as part of Qt and works.
        For the Qt-Windows installation are the .dlls installed in the bin folder or in a lib folder?
        If installed in a lib folder windeployqt.exe is looking also in the wrong folder.

        MesrineM 1 Reply Last reply
        0
        • MesrineM Mesrine

          @Christian-Ehrlicher

          Thanks, do you know how to install Qt6Mqtt on a GitHub runner?
          And how it is that works for the qtquick application and not for the console application.
          For the qtquick application, Qt6Mqtt is not installed as part of Qt and works.
          For the Qt-Windows installation are the .dlls installed in the bin folder or in a lib folder?
          If installed in a lib folder windeployqt.exe is looking also in the wrong folder.

          MesrineM Offline
          MesrineM Offline
          Mesrine
          wrote on last edited by Mesrine
          #4

          @Mesrine
          According to this. I should pass --ignore-library-errors.
          But the CMake API it seems that do not allow it.
          Where is the source code of windeployqt for qt 6.5.0?

          cristian-adamC MesrineM 2 Replies Last reply
          0
          • MesrineM Mesrine

            @Mesrine
            According to this. I should pass --ignore-library-errors.
            But the CMake API it seems that do not allow it.
            Where is the source code of windeployqt for qt 6.5.0?

            cristian-adamC Offline
            cristian-adamC Offline
            cristian-adam
            wrote on last edited by
            #5

            I've opened up https://bugreports.qt.io/browse/QTBUG-116551

            I think the CMake API should provide a way to specify arguments to windeployqt and macdeployqt.

            MesrineM 1 Reply Last reply
            2
            • cristian-adamC cristian-adam

              I've opened up https://bugreports.qt.io/browse/QTBUG-116551

              I think the CMake API should provide a way to specify arguments to windeployqt and macdeployqt.

              MesrineM Offline
              MesrineM Offline
              Mesrine
              wrote on last edited by
              #6

              @cristian-adam Thanks, It is a nice thing to have on the CMake API.

              1 Reply Last reply
              0
              • MesrineM Mesrine

                @Mesrine
                According to this. I should pass --ignore-library-errors.
                But the CMake API it seems that do not allow it.
                Where is the source code of windeployqt for qt 6.5.0?

                MesrineM Offline
                MesrineM Offline
                Mesrine
                wrote on last edited by Mesrine
                #7

                @Mesrine

                It seems that the generic deploy tool uses file(GET_RUNTIME_DEPENDENCIES) of CMake.

                The Qt cmake API allows setting variables like PRE_INCLUDE_REGEXES .

                So, I am wondering how to use something like

                if(QTDEPLOY)
                		qt_generate_deploy_app_script(
                			TARGET ${example}
                			OUTPUT_SCRIPT deploy_script
                			PRE_INCLUDE_REGEXES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/*"
                			)
                
                		install(SCRIPT ${deploy_script})
                endif(QTDEPLOY)
                

                I want to set PRE_INCLUDE_REGEXES to the path the MQTT library was installed.
                The best will be to use DIRECTORIES but I do not see how to pass this from the QT CMake API.

                cristian-adamC MesrineM 2 Replies Last reply
                0
                • MesrineM Mesrine

                  @Mesrine

                  It seems that the generic deploy tool uses file(GET_RUNTIME_DEPENDENCIES) of CMake.

                  The Qt cmake API allows setting variables like PRE_INCLUDE_REGEXES .

                  So, I am wondering how to use something like

                  if(QTDEPLOY)
                  		qt_generate_deploy_app_script(
                  			TARGET ${example}
                  			OUTPUT_SCRIPT deploy_script
                  			PRE_INCLUDE_REGEXES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/*"
                  			)
                  
                  		install(SCRIPT ${deploy_script})
                  endif(QTDEPLOY)
                  

                  I want to set PRE_INCLUDE_REGEXES to the path the MQTT library was installed.
                  The best will be to use DIRECTORIES but I do not see how to pass this from the QT CMake API.

                  cristian-adamC Offline
                  cristian-adamC Offline
                  cristian-adam
                  wrote on last edited by
                  #8

                  This is only available for Linux, on Windows and macOS the windeployqt and macdeployqt tools are used.

                  Woud be nice to have the generic deploy tool, but AFAIK it's not possible.

                  Please do create a bugreport at https://bugreports.qt.io/

                  MesrineM 1 Reply Last reply
                  0
                  • MesrineM Mesrine

                    @Mesrine

                    It seems that the generic deploy tool uses file(GET_RUNTIME_DEPENDENCIES) of CMake.

                    The Qt cmake API allows setting variables like PRE_INCLUDE_REGEXES .

                    So, I am wondering how to use something like

                    if(QTDEPLOY)
                    		qt_generate_deploy_app_script(
                    			TARGET ${example}
                    			OUTPUT_SCRIPT deploy_script
                    			PRE_INCLUDE_REGEXES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/*"
                    			)
                    
                    		install(SCRIPT ${deploy_script})
                    endif(QTDEPLOY)
                    

                    I want to set PRE_INCLUDE_REGEXES to the path the MQTT library was installed.
                    The best will be to use DIRECTORIES but I do not see how to pass this from the QT CMake API.

                    MesrineM Offline
                    MesrineM Offline
                    Mesrine
                    wrote on last edited by
                    #9

                    @Mesrine This does not make much sense because windeploy.exe what it does is to populate the install folder with the QT dependencies.
                    Still, I have not found the windeploy source code to see where it is getting that mqttlibrary path.

                    cristian-adamC 1 Reply Last reply
                    0
                    • cristian-adamC cristian-adam

                      This is only available for Linux, on Windows and macOS the windeployqt and macdeployqt tools are used.

                      Woud be nice to have the generic deploy tool, but AFAIK it's not possible.

                      Please do create a bugreport at https://bugreports.qt.io/

                      MesrineM Offline
                      MesrineM Offline
                      Mesrine
                      wrote on last edited by
                      #10

                      @cristian-adam I see for Linux it is called 'generic Qt deploy tool' and use file(GET_RUNTIME_DEPENDENCIES).
                      Thanks.

                      1 Reply Last reply
                      0
                      • MesrineM Mesrine

                        @Mesrine This does not make much sense because windeploy.exe what it does is to populate the install folder with the QT dependencies.
                        Still, I have not found the windeploy source code to see where it is getting that mqttlibrary path.

                        cristian-adamC Offline
                        cristian-adamC Offline
                        cristian-adam
                        wrote on last edited by
                        #11

                        https://code.qt.io/cgit/qt/qtbase.git/tree/src/tools/windeployqt ist the place for the windeployqt source code.

                        MesrineM 1 Reply Last reply
                        2
                        • cristian-adamC cristian-adam

                          https://code.qt.io/cgit/qt/qtbase.git/tree/src/tools/windeployqt ist the place for the windeployqt source code.

                          MesrineM Offline
                          MesrineM Offline
                          Mesrine
                          wrote on last edited by
                          #12

                          @cristian-adam
                          It seems this part checks if the library is called "Qt6Something" and adds the Qt bin installation directory to the path for the next iteration of the function.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved