[Interest] Creating fat binaries for Qt6 on macOS
Dirk Hohndel
dirk at hohndel.org
Sun Apr 10 19:22:21 CEST 2022
Hi all,
I'm running into a number of interesting problems on macOS. I am testing against the 6.3.0 RC
This is for a fairly complex app called Subsurface, in case anyone cares.
When I create fat binaries for the app by setting CMAKE_OSX_ARCHITECTURES to arm64;x86_64 things mostly work, but a couple of odd things throw me off.
In the make install step I get this error from macdeployqt
Log: change rpaths in "/Users/hohndel/src/subsurface/build/Subsurface.app/Contents/MacOS/Subsurface"
Log: using QList("-delete_rpath", "/Users/hohndel/src/install-root/lib", "-delete_rpath", "/Users/hohndel/Qt/6.3.0/macos/lib", "-delete_rpath", "/Users/hohndel/src/install-root/lib", "-delete_rpath", "/Users/hohndel/Qt/6.3.0/macos/lib",
"-add_rpath", "@loader_path/../Frameworks")
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: \"-delete_rpath /Users/hohndel/src/install-root/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: ""
Log: Using install_name_tool:
Log: change rpaths in "Subsurface.app/Contents/Frameworks/libzip.5.dylib"
Log: using QList("-delete_rpath", "/Users/hohndel/src/install-root/lib", "-delete_rpath", "/Users/hohndel/src/install-root/lib", "-add_rpath", "@loader_path/.")
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: \"-delete_rpath /Users/hohndel/src/install-root/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: ""
Log: Using install_name_tool:
Log: change rpaths in "Subsurface.app/Contents/MacOS/Subsurface"
Log: using QList("-delete_rpath", "/Users/hohndel/src/install-root/lib", "-delete_rpath", "/Users/hohndel/Qt/6.3.0/macos/lib", "-delete_rpath", "/Users/hohndel/src/install-root/lib", "-delete_rpath", "/Users/hohndel/Qt/6.3.0/macos/lib", "-add_rpath", "@loader_path/../Frameworks")
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: \"-delete_rpath /Users/hohndel/src/install-root/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: ""
this seems like a fairly obvious violation of the calling convention of install_name_tool (from Xcode Version 13.3 (13E113) - which I believe is current).
It seems to continue, though, and I can't find anything drastically wrong with the dynamic libraries and the main app afterwards. The dependencies all look right in otool.
But what puzzles me, is this:
% ./Subsurface.app/Contents/MacOS/Subsurface
QQuickWidget is only supported on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default.
qrc:/qml/statsview2.qml: module "QtQml.WorkerScript" is not installed
That first error is weird... I thought Qt on macOS was using OpenGL... is there something that I need to do in the app to avoid that error (the app seems to work fine, mind you).
And that second one is why I'm mainly writing this message... because QtQml.WorkerScript is there. macdeployqt doesn't copy it (I'll need to figure out how to write a bug report for that one), but I manually copy it in place:
% ls -l ./Subsurface.app/Contents/Frameworks/QtQmlWorkerScript.framework
total 0
lrwxrwxrwx 1 hohndel staff 24 Feb 11 12:35 Headers -> Versions/Current/Headers
lrwxrwxrwx 1 hohndel staff 34 Feb 11 12:35 QtQmlWorkerScript -> Versions/Current/QtQmlWorkerScript
lrwxrwxrwx 1 hohndel staff 26 Feb 11 12:35 Resources -> Versions/Current/Resources
drwxr-xr-x 4 hohndel staff 128 Feb 11 12:35 Versions
Any idea what I may be doing wrong? This appears to work if I only build an arm64 binary. But I get the error above for a fat binary. All the libraries and plugins that I can find are indeed fat, e.g.:
% lipo -info ./Subsurface.app/Contents/Frameworks/QtQmlWorkerScript.framework/QtQmlWorkerScript
Architectures in the fat file: ./Subsurface.app/Contents/Frameworks/QtQmlWorkerScript.framework/QtQmlWorkerScript are: x86_64 arm64
Any pointers welcome :)
/D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20220410/3c167a2a/attachment.htm>
More information about the Interest
mailing list