Thanks to visit codestin.com
Credit goes to github.com

Skip to content

uucore build fails on OpenBSD #5448

@lcheylus

Description

@lcheylus

On OpenBSD-current (future version 7.5) on amd64, with Rust 1.73.0,

$ sysctl kern.version
kern.version=OpenBSD 7.4-current (GENERIC) #1356: Sun Oct 22 13:03:10 MDT 2023
    [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
$ rustc -V
rustc 1.73.0 (cc66ad468 2023-10-03) (built from a source tarball)

$ git rev-parse HEAD
769eb29cd3503d7734776572f7875a864c847c92

uucore build fails:

$ cargo build --release --features unix
   Compiling uucore v0.0.22 (/home/fox/dev/coreutils.git/src/uucore)
error[E0432]: unresolved import `libc::endutxent`
  --> src/uucore/src/lib/features/utmpx.rs:43:9
   |
43 | pub use libc::endutxent;
   |         ^^^^^^---------
   |         |     |
   |         |     help: a similar name exists in the module: `endpwent`
   |         no `endutxent` in the root

error[E0432]: unresolved import `libc::getutxent`
  --> src/uucore/src/lib/features/utmpx.rs:44:9
   |
44 | pub use libc::getutxent;
   |         ^^^^^^---------
   |         |     |
   |         |     help: a similar name exists in the module: `getpwent`
   |         no `getutxent` in the root

error[E0432]: unresolved import `libc::setutxent`
  --> src/uucore/src/lib/features/utmpx.rs:45:9
   |
45 | pub use libc::setutxent;
   |         ^^^^^^---------
   |         |     |
   |         |     help: a similar name exists in the module: `setpwent`
   |         no `setutxent` in the root

error[E0432]: unresolved import `libc::utmpx`
  --> src/uucore/src/lib/features/utmpx.rs:46:5
   |
46 | use libc::utmpx;
   |     ^^^^^^^^^^^ no `utmpx` in the root
   |
help: a similar name exists in the module
   |
46 | use libc::utmp;
   |           ~~~~
help: consider importing this module through its public re-export instead
   |
46 | use crate::utmpx;
   |     ~~~~~~~~~~~~

error[E0432]: unresolved import `self::ut`
  --> src/uucore/src/lib/features/utmpx.rs:42:15
   |
42 | pub use self::ut::*;
   |               ^^ could not find `ut` in `self`

error[E0573]: expected type, found module `utmpx`
   --> src/uucore/src/lib/features/utmpx.rs:160:12
    |
160 |     inner: utmpx,
    |            ^^^^^ not a type

error[E0573]: expected type, found module `utmpx
   --> src/uucore/src/lib/features/utmpx.rs:214:32
    |
159 | pub struct Utmpx {
    | ---------------- similarly named struct `Utmpx` defined here
...
214 |     pub fn into_inner(self) -> utmpx {
    |                                ^^^^^ help: a struct with a similar name exists (notice the capitalization): `Utmpx`

error[E0425]: cannot find value `USER_PROCESS` in this scope
   --> src/uucore/src/lib/features/utmpx.rs:218:58
    |
218 |         !self.user().is_empty() && self.record_type() == USER_PROCESS
    |                                                          ^^^^^^^^^^^^ not found in this scope

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/fs.rs:122:16
    |
111 |     pub fn number_of_links(&self) -> u64 {
    |                                      --- expected `u64` because of return type
...
122 |         return self.0.st_nlink;
    |                ^^^^^^^^^^^^^^^ expected `u64`, found `u32`
    |
help: you can convert a `u32` to a `u64`
    |
122 |         return self.0.st_nlink.into();
    |                               +++++++

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/fsext.rs:497:25
    |
497 |                 bavail: statvfs.f_bavail,
    |                         ^^^^^^^^^^^^^^^^ expected `u64`, found `i64`

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/fsext.rs:498:59
    |
498 |                 bavail_top_bit_set: ((statvfs.f_bavail) & (1u64.rotate_right(1))) != 0,
    |                                                           ^^^^^^^^^^^^^^^^^^^^^^ expected `i64`, found `u64`

error[E0277]: no implementation for `i64 & u64`
   --> src/uucore/src/lib/features/fsext.rs:498:57
    |
498 |                 bavail_top_bit_set: ((statvfs.f_bavail) & (1u64.rotate_right(1))) != 0,
    |                                                         ^ no implementation for `i64 & u64`
    |
    = help: the trait `BitAnd<u64>` is not implemented for `i64`
    = help: the following other types implement trait `BitAnd<Rhs>`:
              <i64 as BitAnd>
              <i64 as BitAnd<&i64>>
              <&'a i64 as BitAnd<i64>>
              <&i64 as BitAnd<&i64>>

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/fsext.rs:615:16
    |
606 |     fn block_size(&self) -> i64 {
    |                             --- expected `i64` because of return type
...
615 |         return self.f_bsize;
    |                ^^^^^^^^^^^^ expected `i64`, found `u32`
    |
help: you can convert a `u32` to an `i64`
    |
615 |         return self.f_bsize.into();
    |                            +++++++

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/fsext.rs:644:16
    |
642 |     fn avail_blocks(&self) -> u64 {
    |                               --- expected `u64` because of return type
643 |         #[cfg(all(not(target_os = "freebsd"), target_pointer_width = "64"))]
644 |         return self.f_bavail;
    |                ^^^^^^^^^^^^^ expected `u64`, found `i64`
    |
help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
    |
644 |         return self.f_bavail.try_into().unwrap();
    |                             ++++++++++++++++++++

error[E0425]: cannot find function `utmpxname` in this scope
   --> src/uucore/src/lib/features/utmpx.rs:292:13
    |
292 |             utmpxname(path.as_ptr());
    |             ^^^^^^^^^ help: a function with a similar name exists: `util_name`
    |
   ::: src/uucore/src/lib/lib.rs:146:1
    |
146 | pub fn util_name() -> &'static str {
    | ---------------------------------- similarly named function `util_name` defined here

Some errors have detailed explanations: E0277, E0308, E0425, E0432, E0573.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `uucore` (lib) due to 15 previous errors

After a quick analysis, 2 types of errors here:

  • support of utmpx on OpenBSD in libc crate
  • errors with types in src/uucore/src/lib/features/fs.rs and src/uucore/src/lib/features/fsext.rs => similar to errors detected to support NetBSD (issue#5288).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions