fix: gate whoami to exclude iOS/tvOS/watchOS — fixes aarch64-apple-ios linker error#743
Conversation
`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
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| winapi = { workspace = true } | ||
|
|
||
| [target.'cfg(unix)'.dependencies] | ||
| [target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "tvos"), not(target_os = "watchos")))'.dependencies] |
There was a problem hiding this comment.
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)
|
do you intend to download models from watchOS? |
|
👀 maybe maybe |
|
It was failing on ios! |


Problem
Building any crate that depends on
xet-coreforaarch64-apple-ios(or the iOS simulator) fails at link time:Root cause
whoami v2declaresobjc2-system-configurationas a dependency for alltarget_vendor = "apple"targets — including iOS, tvOS, and watchOS. That crate wrapsSystemConfiguration.framework, which exposesSCDynamicStoreCopyComputerName. The symbol exists on macOS but is not available on iOS/tvOS/watchOS, so the linker fails.Dependency chain:
data→cas_client→file_utils→xet-runtime→whoami→objc2-system-configuration→SCDynamicStoreCopyComputerName💥Why the fix is safe
The only use of
whoamiin xet-runtime is inprivilege_context.rs::permission_warning()— a diagnostic helper that prints achownhint when a permission-denied error occurs. iOS, tvOS, and watchOS have no POSIX multi-user model, so:sudo chownis meaningless on those platformsFix
xet_runtime/Cargo.toml— narrow thewhoamitarget cfg fromunixto exclude Apple mobile targets:privilege_context.rs— mirror the cfg gate on the call site, with a simplified fallback message for mobile targets.Testing
Note
Low Risk
Low risk: changes are limited to target-specific dependency gating and a diagnostic-only warning message, plus a new CI
cargo checkforaarch64-apple-ios. Main potential impact is missing thechownhint on Apple mobile targets, where it is not applicable.Overview
Fixes an iOS-family linker failure by tightening
xet-runtime’swhoamidependency and call sites to excludeios/tvos/watchostargets, avoiding the transitiveSystemConfigurationsymbol.Adds a small regression test around
permission_warning()and introduces a new CI job that runscargo check -p xet-runtime --target aarch64-apple-ioson 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.