cr8t / udev

Pure Rust interface to the userspace devfs (udev) subsystem on Linux
GNU General Public License v2.0
4 stars 1 forks source link

Error: mismatched types on 32 bit architectures #26

Open alexanderkjall opened 4 hours ago

alexanderkjall commented 4 hours ago

When trying to build this on 32-bit system I get this error:

error[E0308]: mismatched types
    --> src/monitor.rs:892:58
     |
892  |                 if unsafe { libc::poll(pfd.as_mut_ptr(), pfd_len, 0) } > 0 {
     |                             ----------                   ^^^^^^^ expected `u32`, found `u64`
     |                             |
     |                             arguments to this function are incorrect
     |
note: function defined here
    --> /usr/share/cargo/registry/libc-0.2.161/src/unix/mod.rs:1398:12
     |
1398 |     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
     |            ^^^^
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
     |
892  |                 if unsafe { libc::poll(pfd.as_mut_ptr(), pfd_len.try_into().unwrap(), 0) } > 0 {
     |                                                                 ++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `udevrs` (lib) due to 1 previous error

Full build log here: https://buildd.debian.org/status/fetch.php?pkg=rust-udevrs&arch=armel&ver=0.3.0-2&stamp=1731531071&raw=0

The error seems to be present on at least armel, armhf and i386 but it looks to be to be a generic 32-vs-64 bit problem.

alexanderkjall commented 3 hours ago

This seems to be the same root cause as this bug: https://github.com/rust-windowing/raw-window-handle/issues/46