Skip to content

coreaudio-sys fails to build under macOS Sonoma (14.0) / Xcode 15.0 #85

@coreh

Description

@coreh

When using LLVM from the default Xcode toolchain in macOS Sonoma (14.0), the build fails with the following error:

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

Caused by:
  process didn't exit successfully: `/Users/coreh/Developer/bevy/target/debug/build/coreaudio-sys-7e0a7d7c97b2ec33/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=COREAUDIO_SDK_PATH
  cargo:rustc-link-lib=framework=AudioUnit
  cargo:rustc-link-lib=framework=CoreAudio
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

  --- stderr
  thread 'main' panicked at '"enum_(unnamed_at_/Applications/Xcode_app/Contents/Developer/Platforms/MacOSX_platform/Developer/SDKs/MacOSX14_0_sdk/usr/include/MacTypes_h_382_1)" is not a valid Ident', /Users/coreh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/fallback.rs:811:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This seems to be caused by this issue: rust-lang/rust-bindgen#2312, which has been fixed in recent versions of bindgen. Interestingly, the issue mentions clang 16, however the clang in the default toolchain in XCode in macOS Sonoma is reported as 15, so it's likely that Apple backported some of the clang 16 changes to clang 15, including the one that's causing this.

Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin23.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

See also:

I believe the solution is to update bindgen to a more recent version that has the fix for this issue.

Edit: Looks like (as reported below) this also affects 13.x after installing Xcode 15.0.


👉 For those finding this issue with the same problem, I was able to work around this by installing clang 15 via homebrew:

brew install llvm@15

Then adding it to my path by following the instructions provided by that command, and rebuilding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions