jguhlin / minimap2-rs

Rust bindings to minimap2 library
Other
64 stars 13 forks source link

error: could not compile `minimap2` (lib) due to 3 previous errors #61

Closed zaka-edd closed 3 months ago

zaka-edd commented 3 months ago

Hi, I encountered errors when trying to compile my code using the latest version of minimap2 (v0.1.19+minimap2.2.28).

cargo build --release
    Updating crates.io index
  Downloaded minimap2 v0.1.19+minimap2.2.28
  Downloaded 1 crate (55.0 KB) in 13.28s
   Compiling minimap2 v0.1.19+minimap2.2.28
error[E0606]: casting `&*mut minimap2_sys::mm_idx_t` as `*const minimap2_sys::mm_idx_t` is invalid
   --> /home/zeddafir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/minimap2-0.1.19+minimap2.2.28/src/htslib.rs:167:21
    |
167 |                     self.idx.as_ref().unwrap() as *const mm_ffi::mm_idx_t,
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0606]: casting `&*mut minimap2_sys::mm_idx_t` as `*const minimap2_sys::mm_idx_t` is invalid
   --> /home/zeddafir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/minimap2-0.1.19+minimap2.2.28/src/htslib.rs:194:25
    |
194 |                         self.idx.as_ref().unwrap() as *const mm_ffi::mm_idx_t,
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/zeddafir/.cargo/registry/src/index.crates.io-6f17d22bba15001f/minimap2-0.1.19+minimap2.2.28/src/htslib.rs:346:20
    |
346 |             inner: aligner.idx.unwrap(),
    |                    ^^^^^^^^^^^^^^^^^^^^ expected `mm_idx_t`, found `*mut mm_idx_t`
    |
    = note:   expected struct `minimap2_sys::mm_idx_t`
            found raw pointer `*mut minimap2_sys::mm_idx_t`

Some errors have detailed explanations: E0308, E0606.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `minimap2` (lib) due to 3 previous errors

I have tried updating dependencies for potential fixes, but the issues persist. Any help in resolving these errors would be greatly appreciated. Thank you!

I am running: rustc 1.78.0 cargo 1.78.0

jguhlin commented 3 months ago

@zaka-edd Ah, it's some old code that needs to be updated with the htslib stuff. Sorry about that! Revert to the previous version, as that won't change the API, and it should work. I'll get this fixed up tomorrow.

jguhlin commented 3 months ago

Should be hitting crates.io very soon. Fixed, but reopen if there are any more issues! Sorry about that. I had CI set up but it all degraded and doesn't run anymore.

martin-g commented 2 months ago

Which version contains the fix ? I am trying to build minimap2-0.1.20+minimap2.2.28 on Linux ARM64 here (as a dependency) but it fails with these 3 errors.

07:07:52 BIOCONDA INFO (OUT) error[E0606]: casting `&*mut minimap2_sys::mm_idx_t` as `*const minimap2_sys::mm_idx_t` is invalid
07:07:52 BIOCONDA INFO (OUT)    --> /opt/conda/conda-bld/chopper_1724137504584/_build_env/.cargo/registry/src/index.crates.io-6f17d22bba15001f/minimap2-0.1.20+minimap2.2.28/src/lib.rs:834:25
07:07:52 BIOCONDA INFO (OUT)     |
07:07:52 BIOCONDA INFO (OUT) 834 |                         self.idx.as_ref().unwrap() as *const mm_idx_t,
07:07:52 BIOCONDA INFO (OUT)     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07:07:52 BIOCONDA INFO (OUT) 
07:07:52 BIOCONDA INFO (OUT) error[E0606]: casting `&*mut minimap2_sys::mm_idx_t` as `*const minimap2_sys::mm_idx_t` is invalid
07:07:52 BIOCONDA INFO (OUT)    --> /opt/conda/conda-bld/chopper_1724137504584/_build_env/.cargo/registry/src/index.crates.io-6f17d22bba15001f/minimap2-0.1.20+minimap2.2.28/src/lib.rs:974:41
07:07:52 BIOCONDA INFO (OUT)     |
07:07:52 BIOCONDA INFO (OUT) 974 | ...                   &self.idx.unwrap() as *const mm_idx_t,
07:07:52 BIOCONDA INFO (OUT)     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07:07:52 BIOCONDA INFO (OUT) 
07:07:52 BIOCONDA INFO (OUT) error[E0606]: casting `&*mut minimap2_sys::mm_idx_t` as `*const minimap2_sys::mm_idx_t` is invalid
07:07:52 BIOCONDA INFO (OUT)     --> /opt/conda/conda-bld/chopper_1724137504584/_build_env/.cargo/registry/src/index.crates.io-6f17d22bba15001f/minimap2-0.1.20+minimap2.2.28/src/lib.rs:1021:41
07:07:52 BIOCONDA INFO (OUT)      |
07:07:52 BIOCONDA INFO (OUT) 1021 | ...                   &self.idx.unwrap() as *const mm_idx_t,
07:07:52 BIOCONDA INFO (OUT)      |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
07:07:52 BIOCONDA INFO (OUT) 
07:07:52 BIOCONDA INFO (OUT) For more information about this error, try `rustc --explain E0606`.
07:07:52 BIOCONDA INFO (OUT) error: could not compile `minimap2` (lib) due to 3 previous errors
07:07:52 BIOCONDA INFO (OUT) 

https://crates.io/crates/minimap2 says that v0.1.20+minimap2.2.28 is the latest.

jguhlin commented 2 months ago

@martin-g Should be fixed even before 0.1.20, hmmm. Thanks for the logs! They helped.

When I download that version I can't run cross, but I can with the main branch

 cross test --target aarch64-unknown-linux-gnu

I'll do some tests and get it pushed out tomorrow then, and hopefully that resolves it for you!