rust-bio / rust-htslib

This library provides HTSlib bindings and a high level Rust API for reading and writing BAM files.
MIT License
308 stars 80 forks source link

error[E0308]: mismatched types - expected raw pointer `*mut u8` during cross compilation #412

Closed Adoni5 closed 9 months ago

Adoni5 commented 1 year ago

Hey guys - I'm trying cross compile into aarch64-unknown-linux. The problem is the bindings seem to expect *mut u8, and are receiving an i8 reference.

 error[E0308]: mismatched types
    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rust-htslib-0.44.1/src/bam/record.rs:2324:17
     |
2319 |             let ret = hts_sys::bam_mods_query_type(
     |                       ---------------------------- arguments to this function are incorrect
...
2324 |                 &mut canonical,
     |                 ^^^^^^^^^^^^^^ expected `*mut u8`, found `&mut i8`
     |
     = note:    expected raw pointer `*mut u8`
             found mutable reference `&mut i8`
note: function defined here
    --> /home/runner/work/cnv_from_bam/cnv_from_bam/target/aarch64-unknown-linux-gnu/release/build/hts-sys-f85a33d3986fc8a3/out/bindings.rs:9439:12
     |
9439 |     pub fn bam_mods_query_type(
     |            ^^^^^^^^^^^^^^^^^^^

Specifically the issue seems to be here in the modified base metadata.

https://github.com/rust-bio/rust-htslib/blob/3008a131f241b423d041c756fc96410f6412e3d8/src/bam/record.rs#L2317-L2325

Am I doing something obviously wrong? I'm cross compiling using an altered version of docker/cross

https://github.com/rust-cross/manylinux-cross/pkgs/container/manylinux_2_28-cross. I'm creating a .so to use with a PyO3 package.

Many Thanks Rory