cpal icon indicating copy to clipboard operation
cpal copied to clipboard

can't compile HEAD; "two different versions of nix"

Open capveg opened this issue 4 years ago • 1 comments

Hi - new to the project and excited to dive in. But I grabbed the head and tried to compile, and it dies with:

error[E0308]: mismatched types --> src/host/alsa/mod.rs:248:26 | 244 | let handle = match handle_result { | ------------- this expression has type std::result::Result<host::alsa::alsa::PCM, (host::alsa::alsa::Error, Option<host::alsa::alsa::nix::errno::Errno>)> ... 248 | Err((_, Some(nix::errno::Errno::EINVAL))) => { | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum host::alsa::alsa::nix::errno::Errno, found enum nix::errno::Errno | = note: perhaps two different versions of crate nix are being used?

And sure enough, there are: git clone https://github.com/RustAudio/cpal cd cpal cargo build [snip] Compiling memoffset v0.6.4 Compiling alsa-sys v0.3.1 Compiling quote v1.0.10 Compiling nix v0.21.2 <------- pulled by deps Compiling nix v0.20.2 <------- pulled by cpal's Cargo.toml Compiling parking_lot v0.11.2 Compiling alsa v0.5.1 Compiling thiserror-impl v1.0.30 Building [=======================> ] 36/39: thiserror-impl
[...]

Updating cpal's Cargo.toml to the newest version seems to fix the compile (happy to submit the trivial patch), but I don't know enough about the project yet to see if that's an OK fix. Trivially, all of the tests in 'cargo test' work. Feedback welcome.

(Oh - and thanks for the cool project!)

[robs@fedora cpal]$ git diff diff --git a/Cargo.toml b/Cargo.toml index fe50c22..232c475 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ lazy_static = "1.4"

[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))'.dependencies] alsa = "0.5" -nix = "0.20" +nix = "0.21" libc = "0.2.65" parking_lot = "0.11" jack = { version = "0.7.0", optional = true }

capveg avatar Oct 28 '21 10:10 capveg

Looks like this also affects rodio (version 0.14) because of it's dependency on cpal release 0.13.

Pull request to fix here: https://github.com/RustAudio/cpal/pull/609

capveg avatar Oct 28 '21 10:10 capveg

i am still getting this error in 0.14 when compiling on linux without jack.

anzbert avatar Oct 23 '22 05:10 anzbert

Not our bug. See https://github.com/diwic/alsa-rs/issues/90 .

est31 avatar Oct 23 '22 07:10 est31