Skip to content

Build failure on loongarch64: no field st_mtime on type libc::stat #2418

@kpcyrd

Description

@kpcyrd

Current behavior 😯

When attempting to update cargo-audit from 0.22.0 to 0.22.1 in Alpine I noticed a build failure in the gix-index crate.

This may be a bug in the libc crate (I'm not sure).

Possibly related to #1817.

error[E0609]: no field `st_mtime` on type `libc::stat`
  --> /builds/kpcyrd/aports/community/cargo-audit/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-index-0.46.0/src/fs.rs:58:34
   |
58 |             let seconds = self.0.st_mtime;
   |                                  ^^^^^^^^ unknown field
   |
help: a field with a similar name exists
   |
58 -             let seconds = self.0.st_mtime;
58 +             let seconds = self.0.st_mtim;
   |
error[E0609]: no field `st_mtime_nsec` on type `libc::stat`
  --> /builds/kpcyrd/aports/community/cargo-audit/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-index-0.46.0/src/fs.rs:63:38
   |
63 |             let nanoseconds = self.0.st_mtime_nsec;
   |                                      ^^^^^^^^^^^^^ unknown field
   |
   = note: available fields are: `st_dev`, `st_ino`, `st_mode`, `st_nlink`, `st_uid` ... and 8 others
error[E0609]: no field `st_ctime` on type `libc::stat`
  --> /builds/kpcyrd/aports/community/cargo-audit/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-index-0.46.0/src/fs.rs:85:34
   |
85 |             let seconds = self.0.st_ctime;
   |                                  ^^^^^^^^ unknown field
   |
help: a field with a similar name exists
   |
85 -             let seconds = self.0.st_ctime;
85 +             let seconds = self.0.st_ctim;
   |
error[E0609]: no field `st_ctime_nsec` on type `libc::stat`
  --> /builds/kpcyrd/aports/community/cargo-audit/tmp/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-index-0.46.0/src/fs.rs:90:38
   |
90 |             let nanoseconds = self.0.st_ctime_nsec;
   |                                      ^^^^^^^^^^^^^ unknown field
   |
   = note: available fields are: `st_dev`, `st_ino`, `st_mode`, `st_nlink`, `st_uid` ... and 8 others

Expected behavior 🤔

cargo-audit builds

Git behavior

Git compiles on loongarch64

Steps to reproduce 🕹

cargo build on loongarch64, I have shell access to a machine like this (kindly provided by cfarm.net/Loongson Technology) and can test patches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions