nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
5.96k stars 302 forks source link

Issue Compiling coreaudio-sys v0.2.6 #714

Open dimitre opened 3 years ago

dimitre commented 3 years ago

Platform macOS Big Sur 11.2.2, on Apple M1 Apologies in advance if there is something duplicate here. after pulling latest version today (Audrey crate to 0.3) and after installing cmake needed I've stumbled on this error: any ideas of how to fix it? thank you

nannou % cargo run --release --example draw

   Compiling coreaudio-sys v0.2.6
The following warnings were emitted during compilation:

warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

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

Caused by:
  process didn't exit successfully: `/Volumes/tool/rust/nannou/target/release/build/coreaudio-sys-df9fc76fa3f5fa03/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=CoreAudio
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
  cargo:warning=set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

  --- stderr
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!', /Users/z/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.53.3/src/ir/context.rs:573:15
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
digeratus commented 3 years ago

I have the same issue.

kmtr commented 3 years ago

I had the same issue and I found a issue that is related this issue and PR. It says coreaudio-sys was fixed in 0.2.8.

RustAudio/coreaudio-sys/issues/47

I tried to update the version with this command.

cargo update -p coreaudio-sys --precise 0.2.8

However I got a next problem.

$cargo update -p coreaudio-sys --precise 0.2.8
    Updating crates.io index
error: failed to select a version for `clang-sys`.
    ... required by package `bindgen v0.56.0`
    ... which is depended on by `coreaudio-sys v0.2.8`
    ... which is depended on by `coreaudio-rs v0.9.1`
    ... which is depended on by `cpal v0.13.1`
    ... which is depended on by `nannou_audio v0.15.0 (/Users/me/nannou/nannou_audio)`
    ... which is depended on by `examples v0.1.0 (/Users/me/nannou/examples)`
versions that meet the requirements `>=1.0.0, <2.0.0` are: 1.1.1, 1.1.0, 1.0.3, 1.0.2, 1.0.1, 1.0.0

the package `clang-sys` links to the native library `clang`, but it conflicts with a previous package which links to `clang` as well:
package `clang-sys v0.29.0`
    ... which is depended on by `bindgen v0.54.0`
    ... which is depended on by `asio-sys v0.2.0`
    ... which is depended on by `cpal v0.13.1`
    ... which is depended on by `nannou_audio v0.15.0 (/Users/me/nannou/nannou_audio)`
    ... which is depended on by `examples v0.1.0 (/Users/me/nannou/examples)`

failed to select a version for `clang-sys` which could resolve this conflict
mmansion commented 3 years ago

Hi.

I also ran into this same issue when updating to nannou v0.15.0.

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

This is what worked for me:

Executing the commands: $ cargo update; then $ cargo clean.

Everything compiled as normal after.

I'm running:

mitchmindtree commented 3 years ago

Thanks all for reporting and sharing workarounds!

@kmtr, the second issue you ran into sounds a lot like this particularly nasty one. It looks like clang-sys recently released a 1.x version, so hopefully we can coordinate an update for both the asio and coreaudio-sys clang-sys dependencies in order to resolve this.