danyspin97 / wpaperd

Modern wallpaper daemon for Wayland
GNU General Public License v3.0
329 stars 25 forks source link

fix compile #87

Open sysedwinistrator opened 2 months ago

sysedwinistrator commented 2 months ago

When I was trying to build the master branch (to see whether it fixes https://github.com/danyspin97/wpaperd/issues/85) with Nix by overriding the src and cargoDeps from the nixpkgs/nixos-unstable package (I only saw that this repo has a Nix flake later); I got the following compile time error:

wpaperd> error[E0308]: mismatched types
wpaperd>    --> daemon/src/render/renderer.rs:436:68
wpaperd>     |
wpaperd> 436 |         let vertex_shader = create_shader(gl, gl::VERTEX_SHADER, &[VERTEX_SHADER_SOURCE.as_ptr()])
wpaperd>     |                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
wpaperd>     |
wpaperd>     = note: expected raw pointer `*const i8`
wpaperd>                found raw pointer `*const u8`
wpaperd> error[E0308]: mismatched types
wpaperd>    --> daemon/src/render/renderer.rs:442:15
wpaperd>     |
wpaperd> 442 |             &[FRAGMENT_SHADER_SOURCE.as_ptr(), shader.as_ptr()],
wpaperd>     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
wpaperd>     |
wpaperd>     = note: expected raw pointer `*const i8`
wpaperd>                found raw pointer `*const u8`
wpaperd> For more information about this error, try `rustc --explain E0308`.
wpaperd> error: could not compile `wpaperd` (bin "wpaperd") due to 2 previous errors
error: builder for '/nix/store/z6k4yk1ykl63kag5hxl9mxlfcm31qz6n-wpaperd-1.0.1.drv' failed with exit code 101;
       last 10 log lines:
       >    --> daemon/src/render/renderer.rs:442:15
       >     |
       > 442 |             &[FRAGMENT_SHADER_SOURCE.as_ptr(), shader.as_ptr()],
       >     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const i8`, found `*const u8`
       >     |
       >     = note: expected raw pointer `*const i8`
       >                found raw pointer `*const u8`
       >
       > For more information about this error, try `rustc --explain E0308`.
       > error: could not compile `wpaperd` (bin "wpaperd") due to 2 previous errors

I just followed the instructions from the error message and changed the type of a function parameter without really understanding the code. But it compiles, and works on my machine.

sysedwinistrator commented 2 months ago

Update: building this for x86_64 fails with the reverse error:

wpaperd> error[E0308]: mismatched types
wpaperd>    --> daemon/src/render/renderer.rs:436:68
wpaperd>     |
wpaperd> 436 |         let vertex_shader = create_shader(gl, gl::VERTEX_SHADER, &[VERTEX_SHADER_SOURCE.as_ptr()])
wpaperd>     |                                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
wpaperd>     |
wpaperd>     = note: expected raw pointer `*const u8`
wpaperd>                found raw pointer `*const i8`
wpaperd> error[E0308]: mismatched types
wpaperd>    --> daemon/src/render/renderer.rs:442:15
wpaperd>     |
wpaperd> 442 |             &[FRAGMENT_SHADER_SOURCE.as_ptr(), shader.as_ptr()],
wpaperd>     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
wpaperd>     |
wpaperd>     = note: expected raw pointer `*const u8`
wpaperd>                found raw pointer `*const i8`
wpaperd> For more information about this error, try `rustc --explain E0308`.
wpaperd> error: could not compile `wpaperd` (bin "wpaperd") due to 2 previous errors
error: builder for '/nix/store/w8wl0rqsr58ancp67dq83sy28fhamcr4-wpaperd-1.0.1.drv' failed with exit code 101;
       last 10 log lines:
       >    --> daemon/src/render/renderer.rs:442:15
       >     |
       > 442 |             &[FRAGMENT_SHADER_SOURCE.as_ptr(), shader.as_ptr()],
       >     |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
       >     |
       >     = note: expected raw pointer `*const u8`
       >                found raw pointer `*const i8`
       >
       > For more information about this error, try `rustc --explain E0308`.
       > error: could not compile `wpaperd` (bin "wpaperd") due to 2 previous errors
danyspin97 commented 2 months ago

For which rust version is the current master failing? The CI uses the current stable toolchain, which is 1.80.1.