macqtdeploy.... cmake... ARM/M1 to intel... oh dear...
-
Hey
Ok So I'm trying to solve 2 problems here.
- Compile on ARM and hope that Intel can run my binary.
- Pack it up and send to my friend.
So I've recently read that latest macos Monterey is automatically compiling universal binaries and it should work on any other 12.0+ mac. But when I send file to my friend he cant execute it.
As to packing it up, the packer "worked" but I cant run the app after he packed it... I get a bit of a crazy log with lots of :
Toolbox.app/Contents/Frameworks/QtSvg.framework/Versions/A/QtSvg (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtSvg.framework/Versions/A/QtSvg (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):" ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):"
When I inspect the app, it appears to have worked, the bundle has data and files and exe is relinked, but it somehow give me error when I run it
"toolbox.app quit unexpectedly. click to report bla bla bla"
Crashed Thread: 0 Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid)) Exception Codes: UNKNOWN_0x32 at 0x0000000102e58000 Exception Codes: 0x0000000000000032, 0x0000000102e58000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace CODESIGNING, Code 2 VM Region Info: 0x102e58000 is in 0x102e58000-0x102ee0000; bytes after start: 0 bytes before end: 557055 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL dyld private memory 102d58000-102e58000 [ 1024K] rw-/rwx SM=PRV ---> mapped file 102e58000-102ee0000 [ 544K] r--/rwx SM=COW ...t_id=3fecca81 GAP OF 0x234000 BYTES __TEXT 103114000-103174000 [ 384K] r-x/r-x SM=COW /usr/lib/dyld Thread 0 Crashed: 0 dyld 0x10314a504 dyld3::MachOFile::compatibleSlice(Diagnostics&, void const*, unsigned long, char const*, dyld3::Platform, bool, dyld3::GradedArchs const&) + 76 1 dyld 0x10312e95c invocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int) + 96 2 dyld 0x10312e95c invocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int) + 96 3 dyld 0x103133d58 dyld4::SyscallDelegate::withReadOnlyMappedFile(Diagnostics&, char const*, bool, void (void const*, unsigned long, bool, dyld4::FileID const&, char const*) block_pointer) const + 132 4 dyld 0x10312e8c8 dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int) + 204 5 dyld 0x1031286d0 invocation function for block in dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 1384 6 dyld 0x103127bc0 dyld4::Loader::forEachResolvedAtPathVar(dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, dyld4::ProcessConfig::PathOverrides::Type, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 780 7 dyld 0x1031277ec invocation function for block in dyld4::Loader::forEachPath(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 148 8 dyld 0x10311dee4 dyld4::ProcessConfig::PathOverrides::forEachPathVariant(char const*, dyld3::Platform, bool, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) const + 672 9 dyld 0x103127740 dyld4::Loader::forEachPath(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 172 10 dyld 0x103127f60 dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 864 11 dyld 0x10312cb60 invocation function for block in dyld4::JustInTimeLoader::loadDependents(Diagnostics&, dyld4::RuntimeState&, dyld4::Loader::LoadOptions const&) + 380 12 dyld 0x103149264 invocation function for block in dyld3::MachOFile::forEachDependentDylib(void (char const*, bool, bool, bool, unsigned int, unsigned int, bool&) block_pointer) const + 148 13 dyld 0x103115f98 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 168 14 dyld 0x1031490ac dyld3::MachOFile::forEachDependentDylib(void (char const*, bool, bool, bool, unsigned int, unsigned int, bool&) block_pointer) const + 172 15 dyld 0x10312c8c8 dyld4::JustInTimeLoader::loadDependents(Diagnostics&, dyld4::RuntimeState&, dyld4::Loader::LoadOptions const&) + 164 16 dyld 0x1031195c0 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 1092 17 dyld 0x10311906c start + 488
Does any of this means to any1 ?
I'm lost.
-
Hi,
Can you explain the steps you took to build your .dmg ?
One thing is not completely clear, does it also happen on your own machine ? -
Hey @SGaist
I've finally found the willpower to fight with mac again... lots of good fixes with the intel&arm build on my end but sadly still issue with QT...
Here is my cmake...>cmake_minimum_required(VERSION 3.22) project(02_qt6Deploy) set(CMAKE_CXX_STANDARD 20) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE INTERNAL "" FORCE) set(QT_PATH /Users/dariusz/Qt/6.3.0/macos/) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_PATH} ) find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED) add_executable(02_qt6Deploy MACOSX_BUNDLE main.cpp) target_link_libraries(02_qt6Deploy Qt::Core Qt::Gui Qt::Widgets ) add_custom_target(deployRuntimeMac ALL COMMAND ${QT_PATH}/bin/macdeployqt ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.app )
Here is my error :
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: \"-delete_rpath /Users/dariusz/Qt/6.3.0/macos/lib\" specified more than once\nUsage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input\n" ERROR: ""
The app works, if I do NOT pass
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE INTERNAL "" FORCE)
Looks like macdeployqt does not know how to handle universal libraries/binaries with combined platforms? -
If memory serves well there was a thread recently on the development mailing about something similar. You might want to check it.
-
If anyone interested, the reason behind that error is that you apparently cannot run unsigned apps on M-chips: https://github.com/orgs/Homebrew/discussions/3088.
To fix this just self-sign the app bundle:
sudo codesign --force --deep -s - toolbox.app