Description
If you attempt to build a library for Mac Catalyst (target aarch64-apple-ios-macabi
) on current nightly on Ventura (13.1), it fails to link with errors like:
ld: in /Users/matthew/workspace/matrix-rust-sdk/target/aarch64-apple-ios-macabi/dbg/deps/libstatic_assertions-fdafb4b8ba800a8a.rlib(lib.rmeta), building for Mac Catalyst, but linking in object file built for , file '/Users/matthew/workspace/matrix-rust-sdk/target/aarch64-apple-ios-macabi/dbg/deps/libstatic_assertions-fdafb4b8ba800a8a.rlib' for architecture arm64
This is because the synthetic Mach-O object files (symbols.o and lib.rmeta) emitted by object
lack LC_BUILD_VERSION load commands to identify them as compatible with Catalyst, so ld complains they have a blank platform: "linking in object file built for ,".
rustc uses gimli's object
to write these object files, so object
needs to be extended to support writing LC_BUILD_VERSION, and then rustc needs to be fixed to write it when building for Catalyst.
I hacked this together as per https://gist.github.com/ara4n/320a53ea768aba51afad4c9ed2168536, but a) this is the first time i've written any rust, b) turns out i don't need Catalyst after all, c) i'm not sure the changes to object
have the right abstractions, d) I don't have bandwidth to land it. So am opening this issue as a breadcrumb trail in the hope someone else finds it useful and can finish it off.