jpegxl-rs icon indicating copy to clipboard operation
jpegxl-rs copied to clipboard

jpegxl-rs and jpegxl-sys version mismatch fails to compile

Open y-guyon opened this issue 5 months ago • 1 comments

Having the following in my Cargo.toml:

[dependencies]
jpegxl-rs = { version = "=0.10.3", features = ["vendored"] }

somehow led to cargo build failing with:

error[E0308]: mismatched types
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jpegxl-rs-0.10.3+libjxl-0.10.2/src/encode.rs:398:17
    |
396 |             JxlEncoderAddBox(
    |             ---------------- arguments to this function are incorrect
397 |                 self.enc,
398 |                 Metadata::box_type(t),
    |                 ^^^^^^^^^^^^^^^^^^^^^ expected `*const JxlBoxType`, found `JxlBoxType`
    |
    = note: expected raw pointer `*const JxlBoxType`
                    found struct `JxlBoxType`
note: function defined here
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jpegxl-sys-0.10.4+libjxl-0.10.3/src/encode.rs:243:12
    |
243 |     pub fn JxlEncoderAddBox(
    |            ^^^^^^^^^^^^^^^^

(note that the opposite, jpegxl-rs 0.10.4 failing to wrap jpegxl-sys 0.10.3, also happened to me)


The following fixed it for me:

[dependencies]
jpegxl-sys = { version = "=0.10.3" }
jpegxl-rs = { version = "=0.10.3", features = ["vendored"] }

Should jpegxl-rs rely on a fixed version of jpegxl-sys to prevent this API interface version mismatch?
For example replace the version by "=0.10.4" here:

https://github.com/inflation/jpegxl-rs/blob/14a7101a8af6540b61f8e91a09e81e44d3830dec/jpegxl-rs/Cargo.toml#L37-L40

y-guyon avatar Sep 18 '24 09:09 y-guyon