Skip to content
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

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

Closed
coreh opened this issue Sep 21, 2023 · 9 comments · Fixed by #86
Closed

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

coreh opened this issue Sep 21, 2023 · 9 comments · Fixed by #86

Comments

@coreh
Copy link

coreh commented Sep 21, 2023

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.

@mchitre
Copy link

mchitre commented Sep 22, 2023

Seeing this on Ventura 13.6 too

@coreh coreh changed the title coreaudio-sys fails to build under macOS Sonoma (14.0) coreaudio-sys fails to build under macOS Sonoma (14.0) / Xcode 15.0 Sep 23, 2023
@dcvz
Copy link

dcvz commented Sep 23, 2023

@simlay @MichaelHills @emilio any chance we can update this to use the new bindgen and get this shipped?

@simlay
Copy link
Member

simlay commented Sep 23, 2023

Yes. I bet there's a dependabot PR with the bindgen fix. I'll merge it and bump the version later today.

@simlay
Copy link
Member

simlay commented Sep 23, 2023

I wasn't really able to reproduce this bug. I have validated that xcode 15 on macOS 13.6 the project builds over in #86.

@simlay
Copy link
Member

simlay commented Sep 23, 2023

@coreh A minor patch version has pushed to crates.io. Let me know if there's still an issue. Also, I should put the current maintainers in the readme so that people know to tag me or MichaelHills. I just hadn't seen the issue yet.

@coreh
Copy link
Author

coreh commented Sep 23, 2023

Thanks! No worries, you didn't take long at all, I opened the issue just a couple days ago.

github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this issue Sep 27, 2023
# Objective

Improve compatibility with macOS Sonoma and Xcode 15.0.

## Solution

- Adds the workaround by @ptxmac to ignore the invalid window sizes
provided by `winit` on macOS 14.0
- This still provides a slightly wrong content size when resizing (it
fails to account for the window title bar, so some content gets clipped
at the bottom) but it's _much better_ than crashing.
- Adds docs on how to work around the `bindgen` bug on Xcode 15.0.

## Related Issues:

- RustAudio/coreaudio-sys#85
- rust-windowing/winit#2876

---

## Changelog

- Added a workaround for a `winit`-related crash under macOS Sonoma
(14.0)

---------

Co-authored-by: Peter Kristensen <[email protected]>
@rsalmei
Copy link

rsalmei commented Oct 1, 2023

I still can't compile a small project with ggez, even with clang 15...
Is there anything I can do, please?

❯ cargo build
   Compiling coreaudio-sys v0.2.8
error: failed to run custom build command for `coreaudio-sys v0.2.8`

Caused by:
  process didn't exit successfully: `/Users/rogerio/Documents/projects/ballbounce/target/debug/build/coreaudio-sys-9b713dd0b6b60e55/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=CoreAudio
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

  --- stderr
  thread 'main' panicked at '"enum_(unnamed_at_/Library/Developer/CommandLineTools/SDKs/MacOSX_sdk/usr/include/MacTypes_h_382_1)" is not a valid Ident', /Users/rogerio/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.67/src/fallback.rs:774:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
❯ clang --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@simlay
Copy link
Member

simlay commented Oct 2, 2023

I still can't compile a small project with ggez, even with clang 15... Is there anything I can do, please?

❯ cargo build
   Compiling coreaudio-sys v0.2.8
error: failed to run custom build command for `coreaudio-sys v0.2.8`

Looks like you're using coreaudio-sys 0.2.8 when you want 0.2.12. Does cargo update fix the build? It's possible that coreaudio-sys is pinned to 0.2.8 in your project. cargo tree is a useful tool for this type of thing.

@rsalmei
Copy link

rsalmei commented Oct 2, 2023

I'm just using an older version of ggez for now. My dependencies are only these:

[dependencies]
rand = "0.8"
termion = "*"
ggez = "0.6"

I don't even have any sounds in this project. Does this mean I have to upgrade ggez to get it to compile?

EDIT: Wow, a cargo update did the trick! It have updated coreaudio-sys to 0.2.13, and it worked!
Thanks @simlay!!

rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
…gine#9905)

# Objective

Improve compatibility with macOS Sonoma and Xcode 15.0.

## Solution

- Adds the workaround by @ptxmac to ignore the invalid window sizes
provided by `winit` on macOS 14.0
- This still provides a slightly wrong content size when resizing (it
fails to account for the window title bar, so some content gets clipped
at the bottom) but it's _much better_ than crashing.
- Adds docs on how to work around the `bindgen` bug on Xcode 15.0.

## Related Issues:

- RustAudio/coreaudio-sys#85
- rust-windowing/winit#2876

---

## Changelog

- Added a workaround for a `winit`-related crash under macOS Sonoma
(14.0)

---------

Co-authored-by: Peter Kristensen <[email protected]>
Subserial pushed a commit to Subserial/bevy_winit_hook that referenced this issue Jan 24, 2024
# Objective

Improve compatibility with macOS Sonoma and Xcode 15.0.

## Solution

- Adds the workaround by @ptxmac to ignore the invalid window sizes
provided by `winit` on macOS 14.0
- This still provides a slightly wrong content size when resizing (it
fails to account for the window title bar, so some content gets clipped
at the bottom) but it's _much better_ than crashing.
- Adds docs on how to work around the `bindgen` bug on Xcode 15.0.

## Related Issues:

- RustAudio/coreaudio-sys#85
- rust-windowing/winit#2876

---

## Changelog

- Added a workaround for a `winit`-related crash under macOS Sonoma
(14.0)

---------

Co-authored-by: Peter Kristensen <[email protected]>
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 a pull request may close this issue.

5 participants