Build rust-sdl problem: expected raw pointer `*const i8`, found raw pointer `*const u8`

Hello,

I try to build rust-sdl, but there are some problems i do not know how to solve them, please help me, guru. Thanks

Compiling sdl v0.3.6 (/home/khadas/rust/sdl/rust-sdl)
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
 --> src/sdl/lib.rs:1:10
  |
1 | #![allow(raw_pointer_derive)]
  |          ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
   --> src/sdl/video.rs:208:9
    |
208 | #[allow(raw_pointer_derive)]
    |         ^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/sdl/cd.rs:78:46
   |
78 |             Ok(str::from_utf8(CStr::from_ptr(cstr).to_bytes()).unwrap().to_string())
   |                                              ^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`

error[E0308]: mismatched types
  --> src/sdl/joy.rs:47:46
   |
47 |             Ok(str::from_utf8(CStr::from_ptr(cstr).to_bytes()).unwrap().to_string())
   |                                              ^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`

error[E0308]: mismatched types
   --> src/sdl/video.rs:501:51
    |
501 |             ll::SDL_LoadBMP_RW(ll::SDL_RWFromFile(cpath.as_ptr(), mode.as_ptr()), 1)
    |                                                   ^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
   --> src/sdl/video.rs:501:67
    |
501 |             ll::SDL_LoadBMP_RW(ll::SDL_RWFromFile(cpath.as_ptr(), mode.as_ptr()), 1)
    |                                                                   ^^^^^^^^^^^^^ expected `i8`, found `u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
   --> src/sdl/video.rs:624:61
    |
624 |             ll::SDL_SaveBMP_RW(self.raw, ll::SDL_RWFromFile(cpath.as_ptr(), mode.as_ptr()), 1) == 0
    |                                                             ^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
   --> src/sdl/video.rs:624:77
    |
624 |             ll::SDL_SaveBMP_RW(self.raw, ll::SDL_RWFromFile(cpath.as_ptr(), mode.as_ptr()), 1) == 0
    |                                                                             ^^^^^^^^^^^^^ expected `i8`, found `u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
  --> src/sdl/wm.rs:42:31
   |
42 |         ll::SDL_WM_SetCaption(CString::new(title.as_bytes()).unwrap().as_ptr(),
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
   |
   = note: expected raw pointer `*const i8`
              found raw pointer `*const u8`

error[E0308]: mismatched types
  --> src/sdl/wm.rs:43:31
   |
43 | ...                   CString::new(icon.as_bytes()).unwrap().as_ptr());
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
   |
   = note: expected raw pointer `*const i8`
              found raw pointer `*const u8`

error[E0308]: mismatched types
   --> src/sdl/sdl.rs:158:36
    |
158 |         let slice = CStr::from_ptr(cstr).to_bytes();
    |                                    ^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`

error[E0308]: mismatched types
   --> src/sdl/sdl.rs:165:31
    |
165 |     unsafe { ll::SDL_SetError(CString::new(err.as_bytes()).unwrap().as_ptr()); }
    |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

warning: unused import: `rand::Rng`
 --> src/sdl/video.rs:4:5
  |
4 | use rand::Rng;
  |     ^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error: aborting due to 10 previous errors; 3 warnings emitted

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

To learn more, run the command again with --verbose.

SDL is deprecated, and this library has been updated 6 years ago. Use SDL2 and an actively-maintained crate instead, e.g. this one.

Thanks for your suggestion.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.