Could not compile `caper` because some trait bounds are not satisfied
hsandt opened this issue · 3 comments
OS: Windows 10
Version: rust 1.21.0, cargo 0.22.0
In my Cargo.toml:
[dependencies]
caper = "0.10.0"
On first build, I get a compile error:
[Running: cargo run --message-format=json]
Updating registryhttps://github.com/rust-lang/crates.io-index
Downloading impose v0.1.0
Downloading lazy_static v1.0.1
...
Downloading shell32-sys v0.1.2
Downloading gdi32-sys v0.1.2
Compiling lzw v0.10.0
Compiling lazy_static v0.1.16
...
Compiling imgui v0.0.18
Compiling imgui-glium-renderer v0.0.18
Compiling caper v0.10.0
error: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:95: the trait boundglium::Display: glium::backend::Facade
is not satisfied
error: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:95: the traitglium::backend::Facade
is not implemented forglium::Display
note: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:95: required byglium_text::TextSystem::new
error: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:96: the trait boundglium::Display: glium::backend::Facade
is not satisfied
error: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:96: the traitglium::backend::Facade
is not implemented forglium::Display
note: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:96: required byglium_text::FontTexture::new
error: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:540: the trait boundglium::Frame: glium::Surface
is not satisfied
error: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:540: the traitglium::Surface
is not implemented forglium::Frame
note: C:\Users\hsandt.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:540: required byglium_text::draw
error: Could not compilecaper
.
Fixed by installing rust 1.27.0 via rustup
I also had to uninstall the standalone version (v1.21.0) I installed from https://www.rust-lang.org/en-US/other-installers.html#standalone because its path had priority over $HOME.cargo\bin.
Maybe the README page should indicate the minimum version required for install. For now all I can say is that it's between 1.22 and 1.27.
Sorry, my mistake, it's still not working with rustc 1.27.0. The problem doesn't seem to come from a Rust feature, but may only be present on Windows. By running cargo check I could get more info:
$ cargo check
Checking caper v0.10.0
error[E0277]: the trait boundglium::Display: glium::backend::Facade
is not satisfied
--> C:\Users\lnguyenhuu.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:95:27
|
95 | let text_system = TextSystem::new(&display);
| ^^^^^^^^^^^^^^^ the traitglium::backend::Facade
is not implemented forglium::Display
|
= note: required byglium_text::TextSystem::new
error[E0277]: the trait bound
glium::Display: glium::backend::Facade
is not satisfied
--> C:\Users\lnguyenhuu.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:96:20
|
96 | let font = FontTexture::new(
| ^^^^^^^^^^^^^^^^ the traitglium::backend::Facade
is not implemented forglium::Display
|
= note: required byglium_text::FontTexture::new
error[E0277]: the trait bound
glium::Frame: glium::Surface
is not satisfied
--> C:\Users\lnguyenhuu.cargo\registry\src\github.com-1ecc6299db9ec823\caper-0.10.0\src\renderer.rs:540:21
|
540 | let _ = glium_text::draw(
| ^^^^^^^^^^^^^^^^ the traitglium::Surface
is not implemented forglium::Frame
|
= note: required byglium_text::draw
error: aborting due to 3 previous errors
For more information about this error, try
rustc --explain E0277
.
error: Could not compilecaper
.
Thanks for reporting, I get this error when building using the published 0.10 version too (on linux).
Usually these errors appear when glium_text_rusttype
and caper
are set to use different versions of the glium crate. So glium_text_rusttype v0.3.0
(the version stated in the Cargo.toml) uses glium v0.19
so should be ok, but for some reason glium_text_rusttype v0.3.1
is being built against, which uses glium v0.20
causing the errors.
Will have a further look into, but the version published on crates is a bit old now, so might be a better idea to build against master (I can't publish the current version yet due to a few deps latest version not being published yet).