Problems with qt_deploy_runtime_dependencies
-
I'm trying to get a deploy script setup to do what I want which is to invoke the deployment with the options --verbose 1 --pdb
No such luck:
set(deploy_tool_options_arg ${deploy_tool_options_arg}"--verbose 1 --hardened-runtime") elseif(WIN32) set(deploy_tool_options_arg ${deploy_tool_options_arg}"--verbose 1 --pdb") endif() # Generate a deployment script to be executed at install time # App bundles on macOS have an .app suffix if(APPLE) set(executable_path "$<TARGET_FILE_NAME:DeepSkyStacker>.app") else() message ("Qt Deploy Bin Dir: " ${QT_DEPLOY_BIN_DIR}) message ("Target filename:" $<TARGET_FILE_NAME:DeepSkyStacker>) set(executable_path "\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:DeepSkyStacker>") endif() message ("executable_path: " ${executable_path}) message ("deploy tools options arg: " ${deploy_tool_options_arg}) qt_generate_deploy_script( TARGET DeepSkyStacker OUTPUT_SCRIPT deploy_script CONTENT " qt_deploy_runtime_dependencies( EXECUTABLE \"${executable_path}\" DEPLOY_TOOL_OPTIONS "${deploy_tool_options_arg}" GENERATE_QT_CONF VERBOSE )")
gets me
CMake Warning (dev) at DeepSkyStacker/CMakeLists.txt:223: 1> [CMake] Syntax Warning in cmake code at column 27 1> [CMake] 1> [CMake] Argument not separated from preceding token by whitespace. 1> [CMake] This warning is for project developers. Use -Wno-dev to suppress it. 1> [CMake] 1> [CMake] CMake Warning (dev) at DeepSkyStacker/CMakeLists.txt:223: 1> [CMake] Syntax Warning in cmake code at column 53 1> [CMake] 1> [CMake] Argument not separated from preceding token by whitespace. 1> [CMake] This warning is for project developers. Use -Wno-dev to suppress it. 1> [CMake] 1> [CMake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 1> [CMake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 1> [CMake] Qt Deploy Bin Dir: . 1> [CMake] Target filename:$<TARGET_FILE_NAME:DeepSkyStacker> 1> [CMake] executable_path: ${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:DeepSkyStacker> 1> [CMake] deploy tools options arg: "--verbose 1 --pdb" 1> [CMake] CMake Error at C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:3603 (message): 1> [CMake] Unexpected arguments: "--verbose 1 --pdb"; 1> [CMake] 1> [CMake] GENERATE_QT_CONF 1> [CMake] VERBOSE 1> [CMake] ) 1> [CMake] Call Stack (most recent call first): 1> [CMake] C:/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:3687 (qt6_generate_deploy_script) 1> [CMake] DeepSkyStacker/CMakeLists.txt:217 (qt_generate_deploy_script) 1> [CMake] -- Configuring incomplete, errors occurred!
line 223 is the one that reads:
DEPLOY_TOOL_OPTIONS "${deploy_tool_options_arg}"
Am I doing something wrong? This was pretty much cribbed direct from the documentation of qt_deploy_runtime_dependencies
David
-
Hi,
The following:
set(deploy_tool_options_arg ${deploy_tool_options_arg}"--verbose 1 --pdb")
looks wrong to me.I think it should rather be:
set(deploy_tool_options_arg "${deploy_tool_options_arg} --verbose 1 --pdb") endif()
Or since it's a list, you could also use the cmake list directive.
Hope it helps
-
@SGaist Thank you!!! That's almost got me where I wanted.
I now have:
# # Force the values of QT_DEPLOY... variables # set (QT_DEPLOY_BIN_DIR ".") set (QT_DEPLOY_LIBEXEC_DIR ".") set (QT_DEPLOY_LIB_DIR ".") set (QT_DEPLOY_PLUGINS_DIR ".") # # Set options for the deployment script # set (deploy_tool_options_arg "") if(APPLE) set(deploy_tool_options_arg "${deploy_tool_options_arg} --hardened-runtime") elseif(WIN32) set(deploy_tool_options_arg "${deploy_tool_options_arg} --pdb") endif() # Generate a deployment script to be executed at install time # App bundles on macOS have an .app suffix if(APPLE) set(executable_path "$<TARGET_FILE_NAME:DeepSkyStacker>.app") else() message ("Qt Deploy Bin Dir: " ${QT_DEPLOY_BIN_DIR}) message ("Target filename:" $<TARGET_FILE_NAME:DeepSkyStacker>) set(executable_path "\${QT_DEPLOY_BIN_DIR}/$<TARGET_FILE_NAME:DeepSkyStacker>") endif() message ("executable_path: " ${executable_path}) message ("deploy tools options arg: " ${deploy_tool_options_arg}) qt_generate_deploy_script( TARGET DeepSkyStacker OUTPUT_SCRIPT deploy_script CONTENT " qt_deploy_runtime_dependencies( EXECUTABLE \"${executable_path}\" DEPLOY_TOOL_OPTIONS ${deploy_tool_options_arg} GENERATE_QT_CONF VERBOSE )" )
which almost works.
However, even though I have set QT_DEPLOY_LIB_DIR, it is writing the Qt Dlls etc. to a bin sub-directory of the install directory:
-- Installing: C:/Users/amonra/Documents/GitHub/DSS/x64/Debug/./DeepSkyStacker.exe -- Writing C:/Users/amonra/Documents/GitHub/DSS/x64/Debug/bin/qt.conf -- Running Qt deploy tool for ./DeepSkyStacker.exe in working directory 'C:/Users/amonra/Documents/GitHub/DSS/x64/Debug' 'C:/Qt/6.8.0/msvc2022_64/bin/windeployqt.exe' './DeepSkyStacker.exe' '--verbose' '2' '--dir' '.' '--libdir' 'bin' '--plugindir' 'plugins' '--qml-deploy-dir' 'qml' '--translationdir' 'translations' '--force' '--qtpaths' 'C:/Qt/6.8.0/msvc2022_64/bin/qtpaths6.exe' '--pdb'
which I don't quite understand.
How to fix that please?
-
P Perdrix referenced this topic on
-
I was able to force the use of --libdir . by adding it to the deploy_tool_options_arg variable.
That resulted in an invocation that looked like this:
'C:/Qt/6.8.0/msvc2022_64/bin/windeployqt.exe' './DeepSkyStacker.exe' '--verbose' '2' '--dir' '.' '--libdir' 'bin' '--plugindir' 'plugins' '--qml-deploy-dir' 'qml' '--translationdir' 'translations' '--force' '--qtpaths' 'C:/Qt/6.8.0/msvc2022_64/bin/qtpaths6.exe' '--pdb' '--libdir' '.'
which is pretty tacky :(
If QT_DEPLOY_LIB_DIR is set to . shouldn't that do the job automatically?
-
-
Hi, quickly re-iterating my response on the bug report:
The QT_DEPLOY_LIB_DIR variable is read-only and needs to be modified by setting the corresponding CMAKE_INSTALL_LIBDIR variable.
This is from the variable's documentation:
QT_DEPLOY_LIB_DIR defaults to the value of ${CMAKE_INSTALL_LIBDIR} (usually lib or lib64), which is provided by CMake's GNUInstallDirs module. To change the value of QT_DEPLOY_LIB_DIR, ensure that the project sets CMAKE_INSTALL_LIBDIR before the Core package is found.
The example at the bottom of that page shows how to change the values.
Changing QT_DEPLOY_LIB_DIR this way should be reflected in windeployqt's options too.