Skip to content

compilation issue when included with flate2 & cloudflare backend #14

@rob-p

Description

@rob-p

Hi @kaizhang,

First, thanks for the nice crate! I was able to get anndata support working for our rust single-cell tool fairly easily!

I'm posting because I discovered a strange conflict when I include this crate along with flate2 (with my preferred cloudflare-zlib implementation)

I posted the issue in more detail in the flate2 repository. However, essentially, the following Cargo.toml is sufficient to trigger the problem:

[package]
name = "test_flate2"
version = "0.1.0"
edition = "2021"

[dependencies]
anndata = "0.6.1"
flate2 = { version = "1.0.35", features = ["cloudflare_zlib"] }

This results in the following compiler error:

error[E0308]: mismatched types
  --> /home/rob/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.35/src/ffi/c.rs:65:25
   |
65 |                 zalloc: Some(allocator::zalloc),
   |                         ^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found `Option<extern "C" fn(..., ..., ...) -> ... {z
alloc}>`
   |
   = note: expected fn pointer `unsafe extern "C" fn(*mut c_void, u32, u32) -> *mut c_void`
                    found enum `Option<extern "C" fn(*mut c_void, u32, u32) -> *mut c_void {zalloc}>`

error[E0308]: mismatched types
  --> /home/rob/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flate2-1.0.35/src/ffi/c.rs:67:24
   |
67 |                 zfree: Some(allocator::zfree),
   |                        ^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found `Option<extern "C" fn(..., ...) {zfree}>`
   |
   = note: expected fn pointer `unsafe extern "C" fn(*mut c_void, *mut c_void)`
                    found enum `Option<extern "C" fn(*mut c_void, *mut c_void) {zfree}>`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `flate2` (lib) due to 2 previous errors

So it seems there is some conflicting / improper definition or it is somehow being included in the wrong place? Hopefully we can figure out what's triggering this so that this crate can be used successfully with flate2 with any of the zlib backends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions