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

Conflicting clang-sys versions cause macOS build to fail #502

Open
vl4dimir opened this issue Apr 1, 2020 · 5 comments
Open

Conflicting clang-sys versions cause macOS build to fail #502

vl4dimir opened this issue Apr 1, 2020 · 5 comments
Labels

Comments

@vl4dimir
Copy link

vl4dimir commented Apr 1, 2020

When building nannou on macOS with cargo build or when running an example (like cargo run --example wgpu_image_sequence), the build fails with the following error:

error: failed to run custom build command for `coreaudio-sys v0.2.2`
Caused by:
  process didn't exit successfully: `/Users/vladimir/Projects/nannou/target/debug/build/coreaudio-sys-90f0bdbabac823db/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=framework=AudioUnit
cargo:rustc-link-lib=framework=CoreAudio
--- stderr
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1159:83: error: expected ','
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1160:98: error: expected ','
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1170:85: error: expected ','
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1159:83: error: expected ',', err: true
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1160:98: error: expected ',', err: true
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1170:85: error: expected ',', err: true
thread 'main' panicked at 'unable to generate bindings: ()', /Users/vladimir/.cargo/registry/src/github.com-1ecc6299db9ec823/coreaudio-sys-0.2.2/build.rs:139:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This seems to be caused by asio-sys' outdated bindgen dependency which is causing a very old version of coreaudio-sys to be favored in order to resolve the clang-sys conflict.

@mitchmindtree said this on Slack:

I believe the main issue is that coreaudio-sys' version of bindgen (0.53) depends on a different version of the clang-sys crate than the asio-sys' version of bindgen (0.46 or something) does. Cargo doesn't know how to deal with having two different versions of clang-sys, as it would require linking to the system's clang library multiple times. Cargo has been known to have troubles with resolving this since forever, and the way it deals with the problem is to only allow a single version of the crate that links to the external library at a time. This seems to be why cargo falls back to an older version of coreaudio-sys that happens to depend on an older version of bindgen that shares the same clang-sys version as asio-sys' version does.

If I hardcode an explicit coreaudio-sys = "0.2.4" in nannou_audio/Cargo.toml, the error received confirms that this is the cause:

error: failed to select a version for `clang-sys`.
    ... required by package `bindgen v0.42.0`
    ... which is depended on by `asio-sys v0.1.0`
    ... which is depended on by `cpal v0.11.0`
    ... which is depended on by `nannou_audio v0.2.0 (/Users/vladimir/Projects/nannou/nannou_audio)`
    ... which is depended on by `examples v0.1.0 (/Users/vladimir/Projects/nannou/examples)`
versions that meet the requirements `^0.24` are: 0.24.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.28.0`
    ... which is depended on by `bindgen v0.53.0`
    ... which is depended on by `coreaudio-sys v0.2.4`
    ... which is depended on by `nannou_audio v0.2.0 (/Users/vladimir/Projects/nannou/nannou_audio)`
    ... which is depended on by `examples v0.1.0 (/Users/vladimir/Projects/nannou/examples)`

Related issues:

@vl4dimir
Copy link
Author

vl4dimir commented Apr 1, 2020

The current workaround if you just want to run the (non-audio) examples from the repo is to comment out nannou_audio from the [dev-dependencies] section of examples/Cargo.toml.

@bcongdon
Copy link

I also found that I had to comment out nannou_laser for similar reasons.

@mitchmindtree
Copy link
Member

@bcongdon interesting, thanks for sharing!

Would you mind providing more info about the nannou_laser issue you were running into? The nannou_laser crate is pure Rust from the ground up and shouldn't require clang-sys or bindgen from memory. I wonder if you're running into a different problem?

@bcongdon
Copy link

Here's the full error I got:

Compiling coreaudio-sys v0.2.2
error[E0425]: cannot find function `connect_timeout` in module `ether_dream::dac::stream`
   --> nannou_laser/src/stream/raw.rs:669:52
    |
669 |         Some(timeout) => ether_dream::dac::stream::connect_timeout(&broadcast, ip, timeout)
    |                                                    ^^^^^^^^^^^^^^^ not found in `ether_dream::dac::stream`

error[E0599]: no method named `set_timeout` found for type `ether_dream::RecvDacBroadcasts` in the current scope
  --> nannou_laser/src/dac.rs:80:29
   |
80 |         self.dac_broadcasts.set_timeout(duration)
   |                             ^^^^^^^^^^^ method not found in `ether_dream::RecvDacBroadcasts`

error[E0599]: no method named `set_nonblocking` found for type `ether_dream::RecvDacBroadcasts` in the current scope
  --> nannou_laser/src/dac.rs:85:29
   |
85 |         self.dac_broadcasts.set_nonblocking(nonblocking)
   |                             ^^^^^^^^^^^^^^^ method not found in `ether_dream::RecvDacBroadcasts`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0425, E0599.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `nannou_laser`.
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `coreaudio-sys v0.2.2`

Caused by:
  process didn't exit successfully: `/Users/bencongdon/Documents/OpenSource/nannou/target/release/build/coreaudio-sys-45fdcaad5ee93f4d/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=framework=AudioUnit
cargo:rustc-link-lib=framework=CoreAudio

--- stderr
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1159:83: error: expected ','
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1160:98: error: expected ','
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1170:85: error: expected ','
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1159:83: error: expected ',', err: true
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1160:98: error: expected ',', err: true
//Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:1170:85: error: expected ',', err: true
thread 'main' panicked at 'unable to generate bindings: ()', src/libcore/result.rs:1189:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

@mitchmindtree
Copy link
Member

Ahhh, it looks like you have two separate errors here!

it's possible you might be missing a cargo update - this should address the nannou_laser errors you are seeing. Those methods were added to the ether-dream crate very recently.

As for the second error, yes this is the same as OPs. Thanks for reporting!

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

No branches or pull requests

3 participants