windeployqt.exe looks for library in the wrong place
-
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 stepRun 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 inD:/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.
-
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 stepRun 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 inD:/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.
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. -
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.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. -
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. -
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
andmacdeployqt
. -
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
andmacdeployqt
.@cristian-adam Thanks, It is a nice thing to have on the CMake API.
-
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 useDIRECTORIES
but I do not see how to pass this from the QT CMake API. -
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 useDIRECTORIES
but I do not see how to pass this from the QT CMake API.This is only available for Linux, on Windows and macOS the
windeployqt
andmacdeployqt
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/
-
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 useDIRECTORIES
but I do not see how to pass this from the QT CMake API. -
This is only available for Linux, on Windows and macOS the
windeployqt
andmacdeployqt
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/
@cristian-adam I see for Linux it is called 'generic Qt deploy tool' and use file(GET_RUNTIME_DEPENDENCIES).
Thanks. -
@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.https://code.qt.io/cgit/qt/qtbase.git/tree/src/tools/windeployqt ist the place for the
windeployqt
source code. -
https://code.qt.io/cgit/qt/qtbase.git/tree/src/tools/windeployqt ist the place for the
windeployqt
source code.