lcnr/crow

Compilation error in image crate

luisvgs opened this issue · 3 comments

Hi, I'd like to try the examples that crow provides in its documentation. However, the image-0.23.1 crate during the compilation process, gives me the following error:

error[E0277]: `dyn std::error::Error` cannot be shared between threads safely
   --> C:\Users\___\.cargo\registry\src\github.com-1ecc6299db9ec823\image-0.23.1\./src\jpeg\decoder.rs:138:83
    |
138 |                 ImageError::Decoding(DecodingError::new(ImageFormat::Jpeg.into(), err))
    |                                                                                   ^^^ `dyn std::error::Error` cannot be shared between threads safely       |
   ::: C:\Users\___\.cargo\registry\src\github.com-1ecc6299db9ec823\image-0.23.1\./src\error.rs:259:12
    |
259 |     pub fn new(
    |            ---
260 |         format: ImageFormatHint,
261 |         err: impl Into<Box<dyn Error + Send + Sync>>,
    |                   ---------------------------------- required by this bound in `error::DecodingError::new`
    |
    = help: the trait `std::marker::Sync` is not implemented for `dyn std::error::Error`
    = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<dyn std::error::Error>`
    = note: required because it appears within the type `std::boxed::Box<dyn std::error::Error>`
    = note: required because of the requirements on the impl of `std::convert::From<std::boxed::Box<dyn std::error::Error>>` for `std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>`
    = note: required because of the requirements on the impl of `std::convert::Into<std::boxed::Box<(dyn std::error::Error + std::marker::Send + std::marker::Sync + 'static)>>` for `std::boxed::Box<dyn std::error::Error>`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `image`.

What can I do in order to solve this issue? My rustc version is 1.43.0-nightly. Thanks in advance.

lcnr commented

Hi, I can't reproduce this on the newest nightly, can you try creating a new crate with only image 0.23.1 as a dependency and check if the error persists?

Hi, my apologizes for the late response. I was able to get rid of the image crate error. However, I'm trying to compile both the example from this repository and the example from the documentation from scratch. But the compiler outputs the following:


error[E0432]: unresolved imports `crow::glutin::event`, `crow::glutin::event_loop`, `crow::glutin::window`
 --> src\main.rs:4:9
  |
4 |         event::{ElementState, Event, MouseButton, VirtualKeyCode, WindowEvent},
  |         ^^^^^ could not find `event` in `glutin`
5 |         event_loop::{ControlFlow, EventLoop},
  |         ^^^^^^^^^^ could not find `event_loop` in `glutin`
6 |         window::WindowBuilder,
  |         ^^^^^^ could not find `window` in `glutin`
 
error[E0061]: this function takes 1 parameter but 2 parameters were supplied
  --> src\main.rs:27:19
   |
27 |       let mut ctx = Context::new(
   |  ___________________^
28 | |         WindowBuilder::new().with_inner_size(LogicalSize::new(WINDOW_WIDTH, WINDOW_HEIGHT)),
29 | |         &event_loop,
30 | |     )?;
   | |_____^ expected 1 parameter
 
error[E0308]: mismatched types
  --> src\main.rs:28:63
   |
28 |         WindowBuilder::new().with_inner_size(LogicalSize::new(WINDOW_WIDTH, WINDOW_HEIGHT)),
   |                                                               ^^^^^^^^^^^^ expected `f64`, found `u32`
   |
help: you can convert an `u32` to `f64`, producing the floating point representation of the integer
   |
28 |         WindowBuilder::new().with_inner_size(LogicalSize::new(WINDOW_WIDTH.into(), WINDOW_HEIGHT)),
   |                                                               ^^^^^^^^^^^^^^^^^^^

Here's the full error log. What am I missing? Thank you very much for the help.

lcnr commented

The readme example is for the current master branch. If you would like to test the new version, consider adding the following line to your Cargo.toml file:

crow = { git = "https://github.com/lcnr/crow" }

In case this works for you, I will publish it as version 0.6.0.

However, I'm trying to compile both the example from this repository and the example from the documentation from scratch

Can you also please post the code of the failing example from the documentation, and the link to the documentation you are using?