kevinmehall / rust-soapysdr

Rust bindings for SoapySDR, the vendor-neutral software defined radio hardware abstraction layer
Apache License 2.0
75 stars 22 forks source link

Build failed with SoapySDR 0.8 #13

Closed SolidTux closed 3 years ago

SolidTux commented 4 years ago

With the current SoapySDR version (compiled from the master branch), the API apparently changed. With that the compilation fails

   Compiling futures-preview v0.3.0-alpha.19
   Compiling soapysdr v0.2.0
error[E0061]: this function takes 6 parameters but 7 parameters were supplied
   --> /home/daniel/.cargo/registry/src/github.com-1ecc6299db9ec823/soapysdr-0.2.0/src/device.rs:379:25
    |
379 |               check_error(SoapySDRDevice_setupStream(self.inner.ptr,
    |  _________________________^
380 | |                 &mut stream as *mut _,
381 | |                 Direction::Rx.into(),
382 | |                 E::STREAM_FORMAT.as_ptr(),
383 | |                 channels.as_ptr(), channels.len(),
384 | |                 args.into().as_raw_const()
385 | |             )).map(|_| RxStream {
    | |_____________^ expected 6 parameters

error[E0061]: this function takes 6 parameters but 7 parameters were supplied
   --> /home/daniel/.cargo/registry/src/github.com-1ecc6299db9ec823/soapysdr-0.2.0/src/device.rs:406:25
    |
406 |               check_error(SoapySDRDevice_setupStream(self.inner.ptr,
    |  _________________________^
407 | |                 &mut stream as *mut _,
408 | |                 Direction::Tx.into(),
409 | |                 E::STREAM_FORMAT.as_ptr(),
410 | |                 channels.as_ptr(), channels.len(),
411 | |                 args.into().as_raw_const()
412 | |             )).map(|_| TxStream {
    | |_____________^ expected 6 parameters

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0061`.
error: could not compile `soapysdr`.

To learn more, run the command again with --verbose.
kevinmehall commented 4 years ago

It looks like master / unreleased 0.8 changes that function to return the stream ptr directly rather than using an out-pointer: https://github.com/pothosware/SoapySDR/pull/212. It uses a macro for C API backwards compatibility, but that isn't supported by rust-bindgen.

I'd ideally like to keep compatibility back to 0.6 because it's in the Ubuntu 18.04 repository. It might be possible to do something in wrapper.h using the compatibility macro or #if SOAPY_SDR_API_VERSION >= ... to expose something with the same API on all versions.

I probably won't get to this soon, but I'd accept a PR.

kevinmehall commented 3 years ago

Fixed in #15, cargo release tracked in #16.