RustAudio / coreaudio-sys

Raw bindings to the OSX CoreAudio framework generated by bindgen (see coreaudio-rs for a more rust-esque wrapper).
MIT License
69 stars 38 forks source link

macOS Big Sur 11.0.1 build failure #42

Closed ootoovak closed 3 years ago

ootoovak commented 4 years ago

This crate does not build on macOS Big Sur 11.0.1 right now. I've tried both the latest version as well as the master branch as of today. I am having a read of the build file to see if I can tweak anything to get it working myself.

ootoovak commented 4 years ago

First issue is there is a problem finding llvm-config but explicitly defining it's location with an environment variable helps it along LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config cargo build.

But it then gets stuck on the current macOS version error: invalid version number in '-mmacosx-version-min=11.0' but as far as I can tell from the code that likely comes from bindgen so I imagine the fix will need to happen there first.

MichaelHills commented 4 years ago

I haven't upgraded to Big Sur yet, but might be helpful to post the full error log? Did you install latest Xcode and command line tools? At a guess, it sounds like your version of clang doesn't know about version 11.0? What version of Xcode/clang are you running?

ootoovak commented 4 years ago

Yeah, installed the latest Xcode and CLI using sudo xcode-select --install.

Clang version is:

Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Build error:

Caused by:
  process didn't exit successfully: `./coreaudio-sys/target/debug/build/coreaudio-sys-f0151f718cd0f5f4/build-script-build` (exit code: 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:rustc-link-lib=framework=OpenAL
  cargo:rustc-link-lib=framework=CoreMIDI
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS

  --- stderr
  error: invalid version number in '-mmacosx-version-min=11.0', err: true
  thread 'main' panicked at 'unable to generate bindings: ()', build.rs:124:39
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/panicking.rs:475
     1: core::panicking::panic_fmt
               at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/panicking.rs:85
     2: core::option::expect_none_failed
               at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/core/src/option.rs:1221
     3: core::result::Result<T,E>::expect
               at ~/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:933
     4: build_script_build::build
               at ./build.rs:124
     5: build_script_build::main
               at ./build.rs:139
     6: core::ops::function::FnOnce::call_once
               at ~/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
MichaelHills commented 4 years ago

Hm, do you know if it's easy to get bindgen to log the clang command it's trying to run? Apparently Big Sur is bricking late 2013 MBPs (though maybe just 13" and I have 15") so I'm holding off on upgrading for the moment just in case...

ootoovak commented 4 years ago

No, I'm not sure but I'll try look through the bindgen docs/code at some point to see if I can figure that out.

For what it is worth I'm on a Late 2013 15" MBP, and thankfully there was no issues. I totally get holding off though and would as well if I knew there was a chance of bricking! 😬

ootoovak commented 4 years ago

Updating the clang-sys in rust-bindgen seems to fix the issue. I've submitted a Pull Request for the update and once that is merged in and released I'll create a Pull Request here for the rust-bindgen dependency update as well.

ootoovak commented 4 years ago

https://github.com/rust-lang/rust-bindgen/pull/1923

ootoovak commented 3 years ago

The Bindgen changes have been merged in so I've now submitted a PR for this project: https://github.com/RustAudio/coreaudio-sys/pull/43

MichaelHills commented 3 years ago

Fixed by https://github.com/RustAudio/coreaudio-sys/pull/43