kornelski / lodepng-rust

All-in-one PNG image encoder/decoder in pure Rust
https://lib.rs/lodepng
zlib License
100 stars 23 forks source link

build fails due to mismatched types #25

Closed musm closed 6 years ago

musm commented 6 years ago
error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:388:47
    |
388 |     lode_error!(rustimpl::lodepng_encode_file(c_path(filename), slice::from_raw_parts(image, 0x1FFFFFFF), w, h, colortype, bitdepth))
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               expected reference, found struct `std::path::PathBuf`
    |                                               help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
               found type `std::path::PathBuf`

error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:393:47
    |
393 |     lode_error!(rustimpl::lodepng_encode_file(c_path(filename), slice::from_raw_parts(image, 0x1FFFFFFF), w, h, ColorType::RGBA, 8))
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               expected reference, found struct `std::path::PathBuf`
    |                                               help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
               found type `std::path::PathBuf`

error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:398:47
    |
398 |     lode_error!(rustimpl::lodepng_encode_file(c_path(filename), slice::from_raw_parts(image, 0x1FFFFFFF), w, h, ColorType::RGB, 8))
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               expected reference, found struct `std::path::PathBuf`
    |                                               help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
               found type `std::path::PathBuf`

error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:388:47
    |
388 |     lode_error!(rustimpl::lodepng_encode_file(c_path(filename), slice::from_raw_parts(image, 0x1FFFFFFF), w, h, colortype, bitdepth))
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               expected reference, found struct `std::path::PathBuf`
    |                                               help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
               found type `std::path::PathBuf`

error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:393:47
    |
393 |     lode_error!(rustimpl::lodepng_encode_file(c_path(filename), slice::from_raw_parts(image, 0x1FFFFFFF), w, h, ColorType::RGBA, 8))
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               expected reference, found struct `std::path::PathBuf`
    |                                               help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
               found type `std::path::PathBuf`

error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:398:47
    |
398 |     lode_error!(rustimpl::lodepng_encode_file(c_path(filename), slice::from_raw_parts(image, 0x1FFFFFFF), w, h, ColorType::RGB, 8))
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               expected reference, found struct `std::path::PathBuf`
    |                                               help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
               found type `std::path::PathBuf`

error[E0308]: mismatched types
   --> C:\Users\Mus\.cargo\registry\src\github.com-1ecc6299db9ec823\lodepng-2.1.4\src\ffi.rs:732:61
    |
732 |     let (v, w, h) = lode_try!(rustimpl::lodepng_decode_file(c_path(filename), colortype, bitdepth));
   Compiling kernel32-sys v    0.2.2
|                                                             ^^^^^^^^^^^^^^^^
    |                                                             |
    |                                                             expected reference, found struct `std::path::PathBuf`
    |                                                             help: consider borrowing here: `&c_path(filename)`
    |
    = note: expected type `&std::path::Path`
rustc 1.24.1 (d3ae9a9e0 2018-02-27)
stable-x86_64-pc-windows-msvc (default)
kornelski commented 6 years ago

Thanks. Fixed in c0106beffc810fc44eda0c2b5529424184929c2e

jeroen commented 6 years ago

Can you push this to crates.io? This is blocking me from building gifski on Windows.

kornelski commented 6 years ago

Oh, I forgot. Done!

jeroen commented 6 years ago

Cool! Can you also update your cargo.lock file in gifski?

jeroen commented 6 years ago

And I think also here: https://github.com/ImageOptim/gifski/blob/master/Cargo.toml#L27

kornelski commented 6 years ago

OK

jeroen commented 6 years ago

Still doesn't work here :( The current gifski crate has hardcoded the dependency to lodepng ^2.1.2. So I think you need to release a new gifski that depends on lodepng ^2.1.5 for it to build on windows...

kornelski commented 6 years ago

In Cargo 2.1.2 means ^2.1.2, so if you use the lockfile or run cargo update, it will use the newer one.

jeroen commented 6 years ago

OK I'll try again, one sec.