railcar
railcar copied to clipboard
Compilation produces 'mismatched types' error on newer kernel
Attempted to build on Intel Clear Linux with the Rust nightly compiler and got the following error:
error[E0308]: mismatched types
--> src/nix_ext.rs:50:40
|
50 | let res = unsafe { libc::setrlimit(resource, rlim) };
| ^^^^^^^^ expected u32, found i32
rustc and kernel version:
tim@thinkclear~/dev/rust/railcar $ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
tim@thinkclear~/dev/rust/railcar $ uname -a
Linux thinkclear 5.1.12-785.native #1 SMP Wed Jun 19 07:09:10 UTC 2019 x86_64 GNU/Linux
I was able to get it built with this patch but I do not know if it's generally applicable, or if I have fully tested that my binary built with this change actually works.
This is odd. It looks like the current libc crate does require u32, whereas in the past it used i32: https://docs.rs/libc/0.2.58/libc/fn.setrlimit.html https://docs.rs/libc/0.2.43/libc/fn.setrlimit.html The other solution would be to lock libc back to an older version as is done in #47