Skip to content

NetBSD build failure #11336

@0323pin

Description

@0323pin

Hi,

After #11176 was merged, I can successfully build coreutils using cargo build.

However building the release tarball with cargo build --no-default-features --features unix fails with:

error[E0255]: the name `ACCOUNTING` is defined multiple times
   --> src/uucore/src/lib/features/utmpx.rs:175:13
    |
167 |     pub const ACCOUNTING: usize = 9;
    |     -------------------------------- previous definition of the value `ACCOUNTING` here
...
175 |     pub use libc::ACCOUNTING;
    |             ^^^^^^^^^^^^^^^^ `ACCOUNTING` reimported here
    |
    = note: `ACCOUNTING` must be defined only once in the value namespace of this module
help: you can use `as` to change the binding name of the import
    |
175 |     pub use libc::ACCOUNTING as OtherACCOUNTING;
    |                              ++++++++++++++++++

warning: unused import: `libc::ACCOUNTING`
   --> src/uucore/src/lib/features/utmpx.rs:175:13
    |
175 |     pub use libc::ACCOUNTING;
    |             ^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default

I saw this was fixed yesterday in de5e4f5
So, I've fetched git-HEAD and once again tried building using cargo build --no-default-features --features unix only to fail with:

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/uptime.rs:159:44
    |
159 |             .filter(|r| r.record_type() == BOOT_TIME)
    |                         ---------------    ^^^^^^^^^ expected `i16`, found `u16`
    |                         |
    |                         expected because this is `i16`
    |
help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
    |
159 |             .filter(|r| r.record_type() == BOOT_TIME.try_into().unwrap())
    |                                                     ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/uptime.rs:306:32
    |
306 |         if ut.record_type() == USER_PROCESS {
    |            ----------------    ^^^^^^^^^^^^ expected `i16`, found `u16`
    |            |
    |            expected because this is `i16`
    |
help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
    |
306 |         if ut.record_type() == USER_PROCESS.try_into().unwrap() {
    |                                            ++++++++++++++++++++

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/utmpx.rs:213:9
    |
212 |     pub fn record_type(&self) -> i16 {
    |                                  --- expected `i16` because of return type
213 |         self.inner.ut_type
    |         ^^^^^^^^^^^^^^^^^^ expected `i16`, found `u16`
    |
help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
    |
213 |         self.inner.ut_type.try_into().unwrap()
    |                           ++++++++++++++++++++

error[E0609]: no field `ut_user` on type `libc::utmpx`
   --> src/uucore/src/lib/features/utmpx.rs:225:34
    |
225 |         chars2string!(self.inner.ut_user)
    |                                  ^^^^^^^ unknown field
    |
    = note: available fields are: `ut_name`, `ut_id`, `ut_line`, `ut_host`, `ut_session` ... and 5 others

error[E0308]: mismatched types
   --> src/uucore/src/lib/features/utmpx.rs:267:58
    |
267 |         !self.user().is_empty() && self.record_type() == USER_PROCESS
    |                                    ------------------    ^^^^^^^^^^^^ expected `i16`, found `u16`
    |                                    |
    |                                    expected because this is `i16`
    |
help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit
    |
267 |         !self.user().is_empty() && self.record_type() == USER_PROCESS.try_into().unwrap()
    |                                                                      ++++++++++++++++++++

Mind that building with default features works fine, but this causes trouble if building with GNU make because, the OS is detected at build time, Detected OS = NetBSD

This leads to the build using cargo build --features feat_external_libstdbuf --profile=release and the above errors.

I want to build with GNU make because I'm working on a package for NetBSD and would like to install the utils as separated uu- binaries rather than the multibinary.

Any suggestions?
Thanks!

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