Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Build fails for aarch64-alpine-linux-musl

未关闭
#341 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust

调研方向

针对 aarch64-alpine-linux-musl 目标运行 cargo build --release,并从 src/uu/lsipc/src/semaphore.rs、message_queue.rs 和 shared_memory.rs 中报告的错误开始处理。还要检查 src/uu/blockdev/src/blockdev.rs 和 src/uu/fsfreeze/src/fsfreeze.rs 中的 ioctl 调用位置。报告的 musl 相关编译错误已解决且 release 构建成功,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Running cargo build --release on the tree results in:

error[E0412]: cannot find type `semid_ds` in crate `libc`
  --> src/uu/lsipc/src/semaphore.rs:27:72
   |
27 |   fn semctl(id: c_int, index: c_int, cmd: c_int) -> Result<(c_int, libc::semid_ds), LsIpcError> {
   |                                                                          ^^^^^^^^ help: a struct with a similar name exists: `shmid_ds`
   |
  ::: /home/user/Devel/distrobox/alpine/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.174/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
   |
5  | / s! {
6  | |     pub struct stack_t {
7  | |         pub ss_sp: *mut c_void,
8  | |         pub ss_flags: c_int,
...  |
78 | | }
   | |_- similarly named struct `shmid_ds` defined here

error[E0412]: cannot find type `semid_ds` in crate `libc`
  --> src/uu/lsipc/src/semaphore.rs:28:25
   |
28 |       let mut stat: libc::semid_ds;
   |                           ^^^^^^^^ help: a struct with a similar name exists: `shmid_ds`
   |
  ::: /home/user/Devel/distrobox/alpine/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.174/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
   |
5  | / s! {
6  | |     pub struct stack_t {
7  | |         pub ss_sp: *mut c_void,
8  | |         pub ss_flags: c_int,
...  |
78 | | }
   | |_- similarly named struct `shmid_ds` defined here

error[E0412]: cannot find type `semid_ds` in crate `libc`
  --> src/uu/lsipc/src/semaphore.rs:75:58
   |
75 |           let sem_info = unsafe { &*(&stat as *const libc::semid_ds).cast::<libc::seminfo>() };
   |                                                            ^^^^^^^^ help: a struct with a similar name exists: `shmid_ds`
   |
  ::: /home/user/Devel/distrobox/alpine/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.174/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
   |
5  | / s! {
6  | |     pub struct stack_t {
7  | |         pub ss_sp: *mut c_void,
8  | |         pub ss_flags: c_int,
...  |
78 | | }
   | |_- similarly named struct `shmid_ds` defined here

error[E0412]: cannot find type `seminfo` in crate `libc`
   --> src/uu/lsipc/src/semaphore.rs:75:81
    |
75  |           let sem_info = unsafe { &*(&stat as *const libc::semid_ds).cast::<libc::seminfo>() };
    |                                                                                   ^^^^^^^ help: a struct with a similar name exists: `sysinfo`
    |
   ::: /home/user/Devel/distrobox/alpine/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.174/src/unix/linux_like/linux/musl/mod.rs:417:1
    |
417 | / s_no_extra_traits! {
418 | |     pub struct sysinfo {
419 | |         pub uptime: c_ulong,
420 | |         pub loads: [c_ulong; 3],
...   |
468 | | }
    | |_- similarly named struct `sysinfo` defined here

error[E0412]: cannot find type `semid_ds` in crate `libc`
   --> src/uu/lsipc/src/semaphore.rs:173:22
    |
173 |           stat: &libc::semid_ds,
    |                        ^^^^^^^^ help: a struct with a similar name exists: `shmid_ds`
    |
   ::: /home/user/Devel/distrobox/alpine/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libc-0.2.174/src/unix/linux_like/linux/musl/b64/mod.rs:5:1
    |
5   | / s! {
6   | |     pub struct stack_t {
7   | |         pub ss_sp: *mut c_void,
8   | |         pub ss_flags: c_int,
...   |
78  | | }
    | |_- similarly named struct `shmid_ds` defined here

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/uu/lsipc/src/display.rs:115:17
    |
115 |     time: libc::time_t,
    |                 ^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
  --> src/uu/lsipc/src/message_queue.rs:87:18
   |
87 |     stime: libc::time_t,
   |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
  --> src/uu/lsipc/src/message_queue.rs:88:18
   |
88 |     rtime: libc::time_t,
   |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
  --> src/uu/lsipc/src/message_queue.rs:89:18
   |
89 |     ctime: libc::time_t,
   |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/uu/lsipc/src/semaphore.rs:165:18
    |
165 |     otime: libc::time_t,
    |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/uu/lsipc/src/semaphore.rs:166:18
    |
166 |     ctime: libc::time_t,
    |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/uu/lsipc/src/shared_memory.rs:107:18
    |
107 |     atime: libc::time_t,
    |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/uu/lsipc/src/shared_memory.rs:108:18
    |
108 |     dtime: libc::time_t,
    |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
   --> src/uu/lsipc/src/shared_memory.rs:109:18
    |
109 |     ctime: libc::time_t,
    |                  ^^^^^^

warning: use of deprecated type alias `libc::time_t`: This type is changed to 64-bit in musl 1.2.0, we'll follow that change in the future release. See #1848 for more info.
  --> src/uu/lsipc/src/utils.rs:40:38
   |
40 | pub(crate) fn local_time(time: libc::time_t) -> Result<libc::tm, LsIpcError> {
   |                                      ^^^^^^

   Compiling uu_uuidgen v0.0.1 (/run/host/home/user/Devel/pmOS/util-linux/src/uu/uuidgen)
   Compiling phf v0.12.1
error[E0609]: no field `__key` on type `ipc_perm`
  --> src/uu/lsipc/src/message_queue.rs:95:32
   |
95 |             key: stat.msg_perm.__key,
   |                                ^^^^^ unknown field
   |
   = note: available fields are: `__ipc_perm_key`, `uid`, `gid`, `cuid`, `cgid` ... and 2 others

   Compiling uu_blockdev v0.0.1 (/run/host/home/user/Devel/pmOS/util-linux/src/uu/blockdev)
error[E0609]: no field `__key` on type `ipc_perm`
   --> src/uu/lsipc/src/shared_memory.rs:115:32
    |
115 |             key: stat.shm_perm.__key,
    |                                ^^^^^ unknown field
    |
    = note: available fields are: `__ipc_perm_key`, `uid`, `gid`, `cuid`, `cgid` ... and 2 others

error[E0277]: the trait bound `i32: From<u32>` is not satisfied
   --> src/uu/blockdev/src/blockdev.rs:202:60
    |
202 |         if libc::ioctl(device_file.as_raw_fd(), ioctl_code.into(), input) < 0 {
    |                                                            ^^^^ the trait `From<u32>` is not implemented for `i32`
    |
    = help: the following other types implement trait `From<T>`:
              `i32` implements `From<&fluent_bundle::types::number::FluentNumber>`
              `i32` implements `From<bool>`
              `i32` implements `From<deranged::RangedI32<MIN, MAX>>`
              `i32` implements `From<dns_lookup::types::AddrFamily>`
              `i32` implements `From<dns_lookup::types::Protocol>`
              `i32` implements `From<dns_lookup::types::SockType>`
              `i32` implements `From<fluent_bundle::types::number::FluentNumber>`
              `i32` implements `From<i16>`
            and 8 others
    = note: required for `u32` to implement `Into<i32>`

   Compiling uu_fsfreeze v0.0.1 (/run/host/home/user/Devel/pmOS/util-linux/src/uu/fsfreeze)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `uu_blockdev` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error[E0277]: the trait bound `i32: From<u32>` is not satisfied
  --> src/uu/fsfreeze/src/fsfreeze.rs:33:55
   |
33 |     if unsafe { libc::ioctl(file.as_raw_fd(), op_code.into(), 0) } < 0 {
   |                                                       ^^^^ the trait `From<u32>` is not implemented for `i32`
   |
   = help: the following other types implement trait `From<T>`:
             `i32` implements `From<&fluent_bundle::types::number::FluentNumber>`
             `i32` implements `From<bool>`
             `i32` implements `From<deranged::RangedI32<MIN, MAX>>`
             `i32` implements `From<dns_lookup::types::AddrFamily>`
             `i32` implements `From<dns_lookup::types::Protocol>`
             `i32` implements `From<dns_lookup::types::SockType>`
             `i32` implements `From<fluent_bundle::types::number::FluentNumber>`
             `i32` implements `From<i16>`
           and 8 others
   = note: required for `u32` to implement `Into<i32>`

error: could not compile `uu_fsfreeze` (lib) due to 1 previous error
Some errors have detailed explanations: E0412, E0609.
For more information about an error, try `rustc --explain E0412`.
warning: `uu_lsipc` (lib) generated 10 warnings
error: could not compile `uu_lsipc` (lib) due to 7 previous errors; 10 warnings emitted

It looks like most of these are differences between glibc and musl breaking the code through the libc crate.

主要语言
Rust
星标
224
派生
62
平均合并
8 小时 4 分钟
30 天内合并 PR
19

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

uutils/util-linux 的其他 Issue

查看 uutils/util-linux 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。