Skip to content

Mac Catalyst (macabi) target objects fail to link #106021

Closed
gimli-rs/object
#524
@ara4n

Description

@ara4n

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.

Metadata

Metadata

Assignees

Labels

A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.O-iosOperating system: iOSO-macosOperating system: macOST-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions