rust-lang / rust-lang/rust

Support "zippered" macOS binaries

Open
#131,216 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-targets C-feature-request O-ios O-macos T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Dynamic libraries on macOS can be built in a way that allows loading them when running under Mac Catalyst as well. This is similar in spirit to universal binaries, but technologically different in that only a single binary and architecture is actually built, which allows for a lot of code sharing.

This can be used in Xcode when creating XCFramework bundles, and is underpinned by the the -darwin-target-variant flag in Clang - but that's the only official docs I could find on it. I did find this note though that explains the details really well.

If we wanted to support this in rustc, there's two questions that need answering:

  • How does the user activate it? A separate triple? An extra commandline flag?
  • How does the user detect this mode of compilation in their code? cfg(all(target_os = "macos", target_abi = "macabi"))? target_abi = "zippered"?

Opening this issue to have a place to refer back to, I'm undecided whether it's worth the effort to try to support, would like to see a concrete use-case first (if you know of one, please comment below!)

@rustbot label O-ios O-macos C-feature-request A-targets

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's Clang -darwin-target-variant reference and the linked note on building a zippered dylib, then examine how rustc represents target triples, command-line options, and cfg values. Establish a concrete use case and decide how users would activate and detect this compilation mode; the issue is done only when those design questions have an agreed direction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.