Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build breakage with libc 0.2.154 from git #2342

Open
asomers opened this issue Mar 22, 2024 · 0 comments · May be fixed by #2343
Open

Build breakage with libc 0.2.154 from git #2342

asomers opened this issue Mar 22, 2024 · 0 comments · May be fixed by #2343

Comments

@asomers
Copy link
Member

asomers commented Mar 22, 2024

Nix builds successfully with the most recently released libc: 0.2.153. But the version currently in git contains some backwards-incompatible changes.

Here is a simplified build output, on FreeBSD amd64:

error[E0308]: mismatched types
   --> src/sys/select.rs:113:65
    |
113 |             range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
    |                                                       --------- ^^^^^^^^^^ expected `usize`, found `i32`
    |                                                       |
    |                                                       arguments to this method are incorrect
    |
help: the return type of this call is `i32` due to the type of the argument passed
   --> src/sys/select.rs:113:23
    |
113 |             range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE),
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^
    |                                                                 |
    |                                                                 this argument influences the return type of `unwrap_or`
note: method defined here
   --> /localhome/somers/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/core/src/option.rs:953:12
    |
953 |     pub fn unwrap_or(self, default: T) -> T {
    |            ^^^^^^^^^
help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit
    |
113 |             range: 0..highest.map(|h| h as usize + 1).unwrap_or(FD_SETSIZE.try_into().unwrap()),
    |                                                                           ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/unistd.rs:826:41
    |
826 |     unsafe { libc::execv(path.as_ptr(), args_p.as_ptr()) };
    |              -----------                ^^^^^^^^^^^^^^^ types differ in mutability
    |              |
    |              arguments to this function are incorrect
    |
    = note: expected raw pointer `*const *mut i8`
               found raw pointer `*const *const i8`
note: function defined here
   --> /usr/home/somers/src/rust/libc/src/unix/mod.rs:843:12
    |
843 |     pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int;
    |            ^^^^^

See
rust-lang/libc#3597
rust-lang/libc#3356
rust-lang/libc#3466

asomers added a commit to asomers/nix that referenced this issue Mar 22, 2024
The next version of libc includes some backwards-incompatible changes.

Fixes nix-rust#2342
@asomers asomers linked a pull request Mar 22, 2024 that will close this issue
asomers added a commit to asomers/nix that referenced this issue Mar 22, 2024
The next version of libc includes some backwards-incompatible changes.

Fixes nix-rust#2342
asomers added a commit to asomers/nix that referenced this issue Mar 22, 2024
The next version of libc includes some backwards-incompatible changes.

Fixes nix-rust#2342
asomers added a commit to asomers/nix that referenced this issue Mar 22, 2024
The next version of libc includes some backwards-incompatible changes.

Fixes nix-rust#2342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant