diwic / alsa-rs

Thin but safe ALSA wrappers for Rust
Apache License 2.0
139 stars 66 forks source link

Build error on arm-unknown-linux-musleabihf #42

Closed PKizzle closed 5 years ago

PKizzle commented 5 years ago
Compiling alsa v0.2.1
     Running `rustc --crate-name alsa /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/alsa-0.2.1/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=976c596c68b6c14b -C extra-filename=-976c596c68b6c14b --out-dir /home/rust/librespot/target/arm-unknown-linux-musleabihf/release/deps --target arm-unknown-linux-musleabihf -L dependency=/home/rust/librespot/target/arm-unknown-linux-musleabihf/release/deps -L dependency=/home/rust/librespot/target/release/deps --extern alsa_sys=/home/rust/librespot/target/arm-unknown-linux-musleabihf/release/deps/libalsa_sys-4c26c22d6bab838f.rlib --extern bitflags=/home/rust/librespot/target/arm-unknown-linux-musleabihf/release/deps/libbitflags-d29977ccc17621f8.rlib --extern libc=/home/rust/librespot/target/arm-unknown-linux-musleabihf/release/deps/liblibc-989e9cf5fcbc9d40.rlib --extern nix=/home/rust/librespot/target/arm-unknown-linux-musleabihf/release/deps/libnix-1ff35c4c0a502aed.rlib --cap-lints allow -L native=/usr/lib/arm-linux-gnueabihf`
error[E0308]: mismatched types
   --> /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/alsa-0.2.1/src/pcm_direct.rs:325:82
    |
325 |             mem: DriverMemory::new(fd, (bufsize as usize) * (channels as usize), info.offset, true)?,
    |                                                                                  ^^^^^^^^^^^ expected i64, found i32
help: you can cast an `i32` to `i64`, which will sign-extend the source value
    |
325 |             mem: DriverMemory::new(fd, (bufsize as usize) * (channels as usize), info.offset.into(), true)?,
    |                                                                                  ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `alsa`.

I could fix this error by changing the line 325 of pcm_direct.rs to: mem: DriverMemory::new(fd, (bufsize as usize) * (channels as usize), info.offset as i64, true)?

Did others experience the same issue and does this error occur on other platforms as well?

diwic commented 5 years ago

Thanks, fixed now.

Since arm does not support the direct mode anyway, I just took the easy way out to fix it. Let me know if you need a release.

diwic commented 5 years ago

Released v0.2.2 now.

PKizzle commented 5 years ago

Thanks. It's working for me!