Skip to content

Test and fix iOS#5158

Draft
madsmtm wants to merge 3 commits into
rust-lang:mainfrom
madsmtm:cargo-apple-runner
Draft

Test and fix iOS#5158
madsmtm wants to merge 3 commits into
rust-lang:mainfrom
madsmtm:cargo-apple-runner

Conversation

@madsmtm

@madsmtm madsmtm commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

Enable testing on iOS using cargo-apple-runner, a tool I maintain for making it easier to run binaries on the iOS/tvOS/watchOS/visionOS simulator.

This reveals a bunch of places where we exposed symbols that are not actually available on iOS, I've cfg-gated those as #[cfg(target_os = "macos")].

Fixes #1054.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target aarch64-apple-ios-sim);
    especially relevant for platforms that may not be checked in CI

@madsmtm madsmtm added A-CI Area: CI-related items O-macos C-testsuite C-cleanup stable-nominated This PR should be considered for cherry-pick to libc's stable release branch github_actions Pull requests that update GitHub Actions code labels Jun 9, 2026
@madsmtm madsmtm force-pushed the cargo-apple-runner branch from 2d10ab7 to f222bd7 Compare June 9, 2026 14:22
Comment thread src/unix/bsd/apple/mod.rs
pub fn proc_listpgrppids(pgrpid: crate::pid_t, buffer: *mut c_void, buffersize: c_int)
-> c_int;
pub fn proc_listchildpids(ppid: crate::pid_t, buffer: *mut c_void, buffersize: c_int) -> c_int;
pub fn proc_pidinfo(

@madsmtm madsmtm Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cfg-gating the sys/proc_info.h stuff will mean the sysinfo crate will no longer compile on iOS/tvOS/watchOS/visionOS, CC @GuillaumeGomez, but it was probably broken before? At least unlikely that actually using these symbols it would get through the App Store.

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I know, people using sysinfo on iOS/App store have access to these functions. Would be nice to have a confirmation though as I can't do it myself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you know who's using sysinfo on iOS? I guess I know that Bevy uses it, so perhaps it's fine, though that might also just be because that code-path is unused (and thus not present in the final binary).

Anyhow, I suspect it's just ProcessInner::open_files that'll need to be gated as macOS-only.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sometimes people open issues/PRs to fix iOS/App store builds but we'd need to go through PRs/issues to find the users. ^^'

@madsmtm madsmtm changed the title Test on iOS Test and fix iOS Jun 9, 2026
@madsmtm madsmtm force-pushed the cargo-apple-runner branch from f222bd7 to 5d33927 Compare June 9, 2026 14:28
Comment thread .github/workflows/ci.yaml
if: matrix.cargo-apple-runner
uses: taiki-e/install-action@0631aa6515c7d545823c67cfae7ef4fc7f490154 # v2.81.8
with:
tool: cargo-apple-runner

@madsmtm madsmtm Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unsure if this is how you'll want this to be installed?

View changes since the review

Comment thread .github/workflows/ci.yaml
Comment on lines +243 to +247
- target: aarch64-apple-ios-sim
os: macos-26
cargo-apple-runner: true
simulator: "iPhone 17"
env: { CARGO_TARGET_AARCH64_APPLE_IOS_SIM_RUNNER: cargo-apple-runner }

@madsmtm madsmtm Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We could add tests for tvOS, watchOS and visionOS here too, if you'd like?

View changes since the review

@madsmtm madsmtm force-pushed the cargo-apple-runner branch from 5d33927 to 3297d7a Compare June 9, 2026 14:31
@madsmtm

madsmtm commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

CI is broken, not sure it's my fault?

@madsmtm madsmtm force-pushed the cargo-apple-runner branch from 3297d7a to edc4abd Compare June 14, 2026 15:06
These are not available on iOS, tvOS, watchOS and visionOS.
@madsmtm madsmtm force-pushed the cargo-apple-runner branch 2 times, most recently from 4e887cf to 9edcebb Compare June 14, 2026 15:25
@madsmtm madsmtm force-pushed the cargo-apple-runner branch from 9edcebb to 999db32 Compare June 14, 2026 15:50
Comment thread ci/run.sh
Comment on lines +28 to +30
# ctest's own tests don't work on Apple devices, since these don't have
# host tooling such as `rustc` or a C compiler.
*ios|tvos|watchos|visionos*) cmd="$cmd --workspace --exclude ctest" ;;

@madsmtm madsmtm Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alternatively we could cfg_attr(..., ignore = "...")-gate everything in ctest/tests/basic.rs, but I went with this because it seemed easier to maintain (and ctest doesn't need to work on iOS, so there's not really a reason to unit test it either).

View changes since the review

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

Labels

A-CI Area: CI-related items C-cleanup C-testsuite github_actions Pull requests that update GitHub Actions code O-macos stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-enable iOS on CI

2 participants