Failing to macdeployqt
-
Qt 6.8.0 on macOS Sequoia, application built OK and then:
[226/227] Linking CXX executable DeepSkyStacker/DeepSkyStacker.app/Contents/MacOS/DeepSkyStacker ld: warning: ignoring duplicate libraries: 'vcpkg_installed/arm64-osx/debug/lib/libjpeg.a' [226/227] Install the project... -- Install configuration: "Debug" -- Running Qt deploy tool for DeepSkyStacker.app in working directory '/Users/amonra/.vs/DSS/arm64/Darwin/Debug' '/opt/Qt/6.8.0/macos/bin/macdeployqt' 'DeepSkyStacker.app' '-appstore-compliant' '-always-overwrite' '--hardened-runtime' CMake Error at /opt/Qt/6.8.0/macos/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:535 (message): Executing /opt/Qt/6.8.0/macos/bin/macdeployqt failed: no such file or directory Call Stack (most recent call first): /opt/Qt/6.8.0/macos/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake:543 (qt6_deploy_runtime_dependencies) .qt/deploy_DeepSkyStacker_0e78a3b7ab.cmake:5 (qt_deploy_runtime_dependencies) DeepSkyStacker/cmake_install.cmake:41 (include) cmake_install.cmake:52 (include) FAILED: CMakeFiles/install.util cd /Users/amonra/.vs/DSS/out/build && /Applications/CMake.app/Contents/bin/cmake -P cmake_install.cmake ninja: build stopped: subcommand failed.
if(NOT LINUX) 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 ("Target filename:" $<TARGET_FILE_NAME:DeepSkyStacker>) set(executable_path "${CMAKE_INSTALL_BINDIR}/$<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} )" ) else() qt_generate_deploy_app_script( TARGET ${PROJECT_NAME} OUTPUT_SCRIPT deploy_script DEPLOY_TOOL_OPTIONS ${deploy_tool_options_arg} ) endif() install (SCRIPT ${deploy_script}) install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION .)
What information do you want to determine what I've missed or done wrong?
Thanks, David
-
Hi,
Looks like your are not setting the executable path correctly in the Apple case. You are just giving the bundle name rather than the path to the bundle.
-
Hmmm, I think I'm now more deeply confused than I was :(
Lets say I want to create an installable "thing" for macOS that contains 3 executables. A, B and C. I guess that's a bundle (or a .dmg containing a bundle?).
My top level directory has a CMakeLists.txt and three sub-dirs A, B and C each of which has their own CMakeLists.txt
In which CMakeLists.txt file (or files) do I place the deployment stuff I showed above? Is there a commented example that I could look at in the hope that this will clear stuff up for me. Clearly I've not got my head round how this works.
In the meantime what changes should I make to the deployment code I posted above to get it to work (with explanations please to ensure that I understand what needs to be done and why).
Thanks
D. -
Did you already read the macOS deployment documentation ?
It does not cover your exact use case (multiple executable in a single bundle) but it should give you already a basic understanding of the process.
-
Well, an app is just one single program. Internally, the "app" is just a folder ending in .app. Inside it you'll find
Contents/MacOS
and that is where the single executable is located which is launched when opening the app (e.g. double clicking on the folder). If you have additional command line programs those usually are not apps (you'd have to typeopen mytool
instead of./mytool
to run the command on the command line). If these are just called from the main app you can hide them inside the app folder (maybeContents/Resources
or createContents/bin
). Otherwise, Apple also has installer packages (.pkg) which extract several items (instead of just a single app folder) to their appropriate places. There would be an appropriate place for command line tools and thePATH
environment variable should also be adapted to make them visible. But, I don't know how to create.pkg
s.If you truly have multiple GUI programs, these should actually be separate apps.
-
I am not using CMake myselft. Instead, our deploy step is just a simple script (this might help even if it is not the perfect solution):
#!/bin/bash echo Delete old application folder. rm -rf MyApp.app echo Copy new application folder. cp -r ../release/MyApp.app ./ install_name_tool -change /usr/local/lib/libomp.dylib @rpath/libomp.dylib MyApp.app/Contents/MacOS/MyApp # our app needs to change the path to this lib mkdir -p MyApp.app/Contents/Frameworks cp libomp.dylib MyApp.app/Contents/Frameworks/ # this is the extra lib we need echo Bundle Qt libs. /Users/Shared/Qt/5.13.2/clang_64/bin/macdeployqt MyApp.app echo Package examples. cp -r examples MyApp.app/Contents/Resources/ echo Create dmg. rm MyApp.dmg bin/create-dmg --volname "MyApp Installer" --background ../src/rc/mac_dmg_background.png --window-pos 200 120 --window-size 598 465 --icon-size 80 --icon MyApp.app 150 330 --hide-extension "MyApp.app" --app-drop-link 450 330 MyApp.dmg MyApp.app echo Done.
In this example we have to link with the OpenMP dynamic library. This is copied into the app folder.
install_name_tool
lets you change the path to dynamic libraries. You need to know the original path inside the executable in order to change it. You can look these up usingotool
on the executable (or was it the app?).In the end we are create a dmg image. This has a background image with an arrow pointing from the app icon to the applications folder (
--app-drop-link
) to suggest the user should just move the app over to the application folder for installation. The image looks something like this:
(You also should have a file namedmac_dmg_background@2x.png
with double the resolution for Retina displays.)