Skip to content

fix: gate whoami to exclude iOS/tvOS/watchOS — fixes aarch64-apple-ios linker error#743

Open
ArthurZucker wants to merge 2 commits intohuggingface:mainfrom
ArthurZucker:fix/ios-whoami-sysconfg-linker-error
Open

fix: gate whoami to exclude iOS/tvOS/watchOS — fixes aarch64-apple-ios linker error#743
ArthurZucker wants to merge 2 commits intohuggingface:mainfrom
ArthurZucker:fix/ios-whoami-sysconfg-linker-error

Conversation

@ArthurZucker
Copy link
Copy Markdown

@ArthurZucker ArthurZucker commented Mar 20, 2026

Problem

Building any crate that depends on xet-core for aarch64-apple-ios (or the iOS simulator) fails at link time:

Undefined symbols for architecture arm64:
  "_SCDynamicStoreCopyComputerName", referenced from:
      objc2_system_configuration in libapp.a (whoami)
ld: symbol(s) not found for architecture arm64

Root cause

whoami v2 declares objc2-system-configuration as a dependency for all target_vendor = "apple" targets — including iOS, tvOS, and watchOS. That crate wraps SystemConfiguration.framework, which exposes SCDynamicStoreCopyComputerName. The symbol exists on macOS but is not available on iOS/tvOS/watchOS, so the linker fails.

Dependency chain: datacas_clientfile_utilsxet-runtimewhoamiobjc2-system-configurationSCDynamicStoreCopyComputerName 💥

Why the fix is safe

The only use of whoami in xet-runtime is in privilege_context.rs::permission_warning() — a diagnostic helper that prints a chown hint when a permission-denied error occurs. iOS, tvOS, and watchOS have no POSIX multi-user model, so:

  1. sudo chown is meaningless on those platforms
  2. The diagnostic message is purely informational, not load-bearing

Fix

xet_runtime/Cargo.toml — narrow the whoami target cfg from unix to exclude Apple mobile targets:

# before
[target.'cfg(unix)'.dependencies]
whoami = { workspace = true }

# after
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "tvos"), not(target_os = "watchos")))'.dependencies]
whoami = { workspace = true }

privilege_context.rs — mirror the cfg gate on the call site, with a simplified fallback message for mobile targets.

Testing

# Must compile clean (no SCDynamicStoreCopyComputerName undefined symbol)
cargo build -p data --target aarch64-apple-ios
cargo build -p data --target aarch64-apple-ios-sim

# macOS behaviour unchanged
cargo test -p xet-runtime

Note

Low Risk
Low risk: changes are limited to target-specific dependency gating and a diagnostic-only warning message, plus a new CI cargo check for aarch64-apple-ios. Main potential impact is missing the chown hint on Apple mobile targets, where it is not applicable.

Overview
Fixes an iOS-family linker failure by tightening xet-runtime’s whoami dependency and call sites to exclude ios/tvos/watchos targets, avoiding the transitive SystemConfiguration symbol.

Adds a small regression test around permission_warning() and introduces a new CI job that runs cargo check -p xet-runtime --target aarch64-apple-ios on macOS runners to catch future target-specific build issues.

Written by Cursor Bugbot for commit 912eb81. This will update automatically on new commits. Configure here.

`whoami v2` pulls in `objc2-system-configuration` on all Apple targets
(`target_vendor = "apple"`), which references `SCDynamicStoreCopyComputerName`
from SystemConfiguration.framework. That symbol exists on macOS but is
absent on iOS, tvOS, and watchOS, causing a linker error when building
for `aarch64-apple-ios`.

The `whoami` usage in `privilege_context.rs` is purely diagnostic — it
formats a `chown` hint when a permission-denied error occurs. iOS/tvOS/watchOS
have no POSIX multi-user concept, so the `chown` suggestion is meaningless
there anyway.

Changes:
- `xet_runtime/Cargo.toml`: narrow the `whoami` target cfg from `unix` to
  exclude Apple mobile/embedded targets
- `privilege_context.rs`: mirror the cfg gate so the `whoami::username()`
  call is compiled out on those targets, replaced with a plain message

Fixes compilation for `aarch64-apple-ios` (and simulator) targets.
- ci.yml: new  job runs  on macos-latest to catch regressions
  where Apple-mobile-hostile symbols sneak back in via deps
- privilege_context.rs: add  module with a
  simple no-panic test that also serves as a cross-platform compile
  regression guard
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread xet_runtime/Cargo.toml
winapi = { workspace = true }

[target.'cfg(unix)'.dependencies]
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "tvos"), not(target_os = "watchos")))'.dependencies]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visionOS not excluded from cfg gates like other Apple mobile targets

Low Severity

The cfg gates exclude ios, tvos, and watchos but miss visionos. Apple visionOS (aarch64-apple-visionos) has been a tier 3 Rust target since 1.79.0 and also lacks SCDynamicStoreCopyComputerName from SystemConfiguration.framework. Building for visionOS would hit the same linker error this PR fixes for the other Apple mobile platforms. Adding not(target_os = "visionos") to the dependency and code cfg gates would make the fix complete.

Additional Locations (2)
Fix in Cursor Fix in Web

@julien-c
Copy link
Copy Markdown
Member

do you intend to download models from watchOS?

@ArthurZucker
Copy link
Copy Markdown
Author

👀 maybe maybe

@ArthurZucker
Copy link
Copy Markdown
Author

It was failing on ios!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants