Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Builds fail on my Apple Silicon MacBook #20

Closed
colinbdclark opened this issue Apr 27, 2021 · 3 comments
Closed

Builds fail on my Apple Silicon MacBook #20

colinbdclark opened this issue Apr 27, 2021 · 3 comments

Comments

@colinbdclark
Copy link
Collaborator

This may be an issue with Big Sur or with running on M1 hardware, I'm not sure. However, when I try to build flocking-cpal, I get the following error

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: `~/code/flocking-core/target/debug/build/coreaudio-sys-ba8cad63afa3ce94/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: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/colin/.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

This seems to have to with the ASIO feature being turned on by default, and the Windows-specific specification of an older version of clang in flocking-cpal's Cargo.toml. Why this is the case only on M1, I'm not sure.

@colinbdclark
Copy link
Collaborator Author

In practice, I think it makes sense to follow how CPAL's build system handles it, and build ASIO support only in CI using the --feature asio flag.

@colinbdclark
Copy link
Collaborator Author

But the question is still why the older version of clang is included even on macOS? The only way I can get the system to build on Apple Silicon is to both remove the Windows-specific dependency block and to not specify the ASIO feature to CPAL.

@colinbdclark
Copy link
Collaborator Author

I can't find any way to make platform-conditional dependencies work correctly, at least like this:

[dependencies]
flocking = { path = "../flocking" }

[target.'cfg(target_os = "macos")'.dependencies]
cpal = "0.13.3"

[target.'cfg(target_os = "windows")'.dependencies]
cpal = {version = "0.13.3", features = ["asio"]}
clang-sys = "0.29.3"

[target.'cfg(target_os = "linux")'.dependencies]
cpal = {version = "0.13.3", features = ["jack"]}

In this case, as best as I can tell I always end build building with the "asio" feature enabled and including the 0.29.3 version of clang-sys that is specified for Windows, even on macOS. Either of the two being present will cause this error on Apple Silicon.

Realistically, I think this means we're going to have to drop support for ASIO on Windows until this can be resolved (and ideally CPAL sorts out its crashing issue with ASIO, too).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant