Skip to content
This repository has been archived by the owner on Jan 9, 2020. It is now read-only.

Compilation produces 'mismatched types' error on newer kernel #50

Open
tmlbl opened this issue Jun 27, 2019 · 1 comment
Open

Compilation produces 'mismatched types' error on newer kernel #50

tmlbl opened this issue Jun 27, 2019 · 1 comment

Comments

@tmlbl
Copy link

tmlbl commented Jun 27, 2019

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.

@vishvananda
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants