Skip to content

mismatched types error when compiling for aarch64 #2

@apcamargo

Description

@apcamargo

I submitted PR to add nafcodec to Bioconda. However, the Linux aarch64 build is failing with the error below.

Apparently, this issue arises because char is unsigned when compiling for this architecture. Fortunately, this seems to be straightforward to fix (as seen here: kubo/rust-oracle@38ae40a).

02:04:24 BIOCONDA INFO (OUT)       error[E0308]: mismatched types
02:04:24 BIOCONDA INFO (OUT)          --> nafcodec-py/nafcodec/pyfile.rs:120:21
02:04:24 BIOCONDA INFO (OUT)           |
02:04:24 BIOCONDA INFO (OUT)       119 |                 let m = pyo3::ffi::PyMemoryView_FromMemory(
02:04:24 BIOCONDA INFO (OUT)           |                         ---------------------------------- arguments to this function are incorrect
02:04:24 BIOCONDA INFO (OUT)       120 |                     buf.as_mut_ptr() as *mut i8,
02:04:24 BIOCONDA INFO (OUT)           |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
02:04:24 BIOCONDA INFO (OUT)           |
02:04:24 BIOCONDA INFO (OUT)           = note: expected raw pointer `*mut u8`
02:04:24 BIOCONDA INFO (OUT)                      found raw pointer `*mut i8`
02:04:24 BIOCONDA INFO (OUT)       note: function defined here
02:04:24 BIOCONDA INFO (OUT)          --> /opt/conda/conda-bld/nafcodec_1737684109737/_build_env/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-ffi-0.21.2/src/memoryobject.rs:27:12
02:04:24 BIOCONDA INFO (OUT)           |
02:04:24 BIOCONDA INFO (OUT)       27  |     pub fn PyMemoryView_FromMemory(
02:04:24 BIOCONDA INFO (OUT)           |            ^^^^^^^^^^^^^^^^^^^^^^^
02:04:24 BIOCONDA INFO (OUT)      
02:04:24 BIOCONDA INFO (OUT)       error[E0308]: mismatched types
02:04:24 BIOCONDA INFO (OUT)          --> nafcodec-py/nafcodec/pyfile.rs:212:21
02:04:24 BIOCONDA INFO (OUT)           |
02:04:24 BIOCONDA INFO (OUT)       211 |                 let m = pyo3::ffi::PyMemoryView_FromMemory(
02:04:24 BIOCONDA INFO (OUT)           |                         ---------------------------------- arguments to this function are incorrect
02:04:24 BIOCONDA INFO (OUT)       212 |                     buf.as_ptr() as *mut i8,
02:04:24 BIOCONDA INFO (OUT)           |                     ^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
02:04:24 BIOCONDA INFO (OUT)           |
02:04:24 BIOCONDA INFO (OUT)           = note: expected raw pointer `*mut u8`
02:04:24 BIOCONDA INFO (OUT)                      found raw pointer `*mut i8`
02:04:24 BIOCONDA INFO (OUT)       note: function defined here
02:04:24 BIOCONDA INFO (OUT)          --> /opt/conda/conda-bld/nafcodec_1737684109737/_build_env/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-ffi-0.21.2/src/memoryobject.rs:27:12
02:04:24 BIOCONDA INFO (OUT)           |
02:04:24 BIOCONDA INFO (OUT)       27  |     pub fn PyMemoryView_FromMemory(
02:04:24 BIOCONDA INFO (OUT)           |            ^^^^^^^^^^^^^^^^^^^^^^^
02:04:24 BIOCONDA INFO (OUT)      
02:04:24 BIOCONDA INFO (OUT)       For more information about this error, try `rustc --explain E0308`.
02:04:24 BIOCONDA INFO (OUT)       error: could not compile `nafcodec-py` (lib) due to 2 previous errors
02:04:24 BIOCONDA INFO (OUT)      
02:04:24 BIOCONDA INFO (OUT)       Caused by:
02:04:24 BIOCONDA INFO (OUT)         process didn't exit successfully: `rustc --crate-name nafcodec_py --edition=2021 nafcodec-py/nafcodec/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="extension-module"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("default", "extension-module", "nightly"))' -C metadata=449b9cf977d1d290 --out-dir /opt/conda/conda-bld/nafcodec_1737684109737/work/target/aarch64-unknown-linux-gnu/release/deps --target aarch64-unknown-linux-gnu -C linker=/opt/conda/conda-bld/nafcodec_1737684109737/_build_env/bin/aarch64-conda-linux-gnu-cc -C strip=debuginfo -L dependency=/opt/conda/conda-bld/nafcodec_1737684109737/work/target/aarch64-unknown-linux-gnu/release/deps -L dependency=/opt/conda/conda-bld/nafcodec_1737684109737/work/target/release/deps --extern nafcodec=/opt/conda/conda-bld/nafcodec_1737684109737/work/target/aarch64-unknown-linux-gnu/release/deps/libnafcodec-68f3b8d8e05349e0.rlib --extern pyo3=/opt/conda/conda-bld/nafcodec_1737684109737/work/target/aarch64-unknown-linux-gnu/release/deps/libpyo3-9ff1c47e749b35ca.rlib -L native=/opt/conda/conda-bld/nafcodec_1737684109737/work/target/aarch64-unknown-linux-gnu/release/build/zstd-sys-3c9ad381a5044a09/out` (exit status: 1)
02:04:24 BIOCONDA INFO (OUT)       error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path nafcodec-py/Cargo.toml --target aarch64-unknown-linux-gnu --release -v --features 'extension-module pyo3/extension-module' --crate-type cdylib --` failed with code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions