kaizhang/anndata-rs

Issues when compiling `pyanndata` during build of `SnapATAC2`

Opened this issue · 1 comments

I'm currently attempting to build SnapATAC2 for Windows, but I'm running into an issue with pyanndata.
I'm building v0.2.1 of pyanndata while building v2.5.3 of SnapATAC2.

There seems to be an incompatibility with c_long mapping to i32 on Windows, but i64 on Linux.

(venv) → ~\Desktop\SnapATAC2\snapatac2-python [(v2.5.3) +1 ~0 -0 !]› maturin build --release
⚠️  Warning: `build-backend` in pyproject.toml is not set to `maturin`, packaging tools such as pip will not use maturin to build this project.
🔗 Found pyo3 bindings
🐍 Found CPython 3.10 at C:\Users\zach\Desktop\SnapATAC2\venv\Scripts\python.exe
   Compiling pyanndata v0.2.1
error[E0308]: mismatched types
  --> C:\Users\zach\.cargo\registry\src\index.crates.io-6f17d22bba15001f\pyanndata-0.2.1\src\data\slice.rs:23:31
   |
23 |         let s = slice.indices(length as i64)?;
   |                       ------- ^^^^^^^^^^^^^ expected `i32`, found `i64`
   |                       |
   |                       arguments to this method are incorrect
   |
note: method defined here
  --> C:\Users\zach\.cargo\registry\src\index.crates.io-6f17d22bba15001f\pyo3-0.20.0\src\types\slice.rs:69:12
   |
69 |     pub fn indices(&self, length: c_long) -> PyResult<PySliceIndices> {
   |            ^^^^^^^
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
   |
23 |         let s = slice.indices((length as i64).try_into().unwrap())?;
   |                               +             +++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `pyanndata` (lib) due to 1 previous error
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit code: 101": `"cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "C:\\Users\\zach\\Desktop\\SnapATAC2\\snapatac2-python\\Cargo.toml" "--release" "--lib"`

Note I fixed this locally by just swapping as i64 into as c_long - I'm not sure if this will break things though...