Skip to content

Remap iOS simulator target names to fix the build for the simulator #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

plaidfinch
Copy link

@plaidfinch plaidfinch commented Apr 16, 2025

This adds additional logic to the build.rs script which handles the mismatch between the -sim and -simulator suffixes — Rust uses the former, and Clang (at least, Apple clang version 17.0.0 (clang-1700.0.13.3) Target: arm64-apple-darwin24.3.0) expects the latter.

This patch is motivated by a need to fix the build of cpal for the iOS simulator — at present, it fails (at least on my machine) due to this error:

error: failed to run custom build command for `coreaudio-sys v0.2.16`

Caused by:
  process didn't exit successfully: `/target/release/build/coreaudio-sys-a853612bd3562b3f/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=COREAUDIO_SDK_PATH
  cargo:rustc-link-lib=framework=AudioToolbox
  cargo:rustc-link-lib=framework=AudioToolbox
  cargo:rustc-link-lib=framework=CoreAudio
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

  --- stderr

  thread 'main' panicked at /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/coreaudio-sys-0.2.16/build.rs:162:39:
  unable to generate bindings: ClangDiagnostic("error: version 'sim' in target triple 'aarch64-apple-ios-sim' is invalid\n")

I can confirm that with a workspace patch pointed at this fork, cpal is able to build successfully for iOS simulator.

This adds additional logic to the `build.rs` script which handles the mismatch between the `-sim` and `-simulator` suffixes — Rust uses the former, and Clang expects the latter.
@plaidfinch
Copy link
Author

It appears this may be duplicative of #112; I'm not sure if these overrides are necessary in all environments, but the fix above works in mine.

@simlay
Copy link
Member

simlay commented Apr 17, 2025

It appears this may be duplicative of #112; I'm not sure if these overrides are necessary in all environments, but the fix above works in mine.

I believe it is. I'm currently waiting on a new release of rust-bindgen to include rust-lang/rust-bindgen#3182.

@plaidfinch
Copy link
Author

It appears this may be duplicative of #112; I'm not sure if these overrides are necessary in all environments, but the fix above works in mine.

I believe it is. I'm currently waiting on a new release of rust-bindgen to include rust-lang/rust-bindgen#3182.

Ah, great! Thanks for following up on this — should I raise this with cpal, so we can get that dependency bumped once you've been able to incorporate the new bindgen release?

@simlay
Copy link
Member

simlay commented Apr 18, 2025

Ah, great! Thanks for following up on this — should I raise this with cpal, so we can get that dependency bumped once you've been able to incorporate the new bindgen release?

Nah. This should be a patch release on coreaudio-sys and won't require updating cpal or coreaudio-rs.

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