emoon / rust_minifb

Cross platfrom window and framebuffer crate for Rust
MIT License
1k stars 95 forks source link

Fails to compile on Raspberry Pi #291

Closed wtfuzz closed 2 years ago

wtfuzz commented 2 years ago

I get the following error on a Raspberry Pi 400 running 64 bit bullseye.

Rust version:

$ rustc --version
rustc 1.60.0 (7737e0b5c 2022-04-04)
error[E0308]: mismatched types
    --> /home/fuzz/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.22.0/src/os/posix/wayland.rs:1092:25
     |
1092 |                         addr as *const i8,
     |                         ^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`

error[E0308]: mismatched types
   --> /home/fuzz/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.22.0/src/os/posix/x11.rs:400:41
    |
400 |             (d.lib.XSetLocaleModifiers)(empty_string.as_ptr() as *const i8);
    |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`

error[E0308]: mismatched types
   --> /home/fuzz/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.22.0/src/os/posix/x11.rs:625:62
    |
625 |                     (self.d.lib.XInternAtom)(self.d.display, net_string_ptr, xlib::False),
    |                                                              ^^^^^^^^^^^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`

error[E0308]: mismatched types
   --> /home/fuzz/.cargo/registry/src/github.com-1ecc6299db9ec823/minifb-0.22.0/src/os/posix/x11.rs:626:62
    |
626 |                     (self.d.lib.XInternAtom)(self.d.display, cardinal_ptr, xlib::False),
    |                                                              ^^^^^^^^^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`

For more information about this error, try `rustc --explain E0308`.
emoon commented 2 years ago

Thanks for the report.

I wonder can you try to changes the places where this happens to do:

addr as _;

and

cardinal_ptr as _

And see if that fixes the compile issues.

wtfuzz commented 2 years ago

Using coercion does fix the compilation issues. Examples are now running successfully on this Pi. I've opened PR #292 with the changes.