Skip to content

Alpine musl libc build fails with cannot construct msghdr with struct literal syntax due to private fields #2222

@strophy

Description

@strophy

I'm trying to package quiche 0.24.5 for Alpine Linux , building with Rust 1.90 and latest libc crate 0.2.177. This errors with:

   Compiling serde_path_to_error v0.1.20
   Compiling datagram-socket v0.3.0 (/home/builder/package/testing/quiche/src/quiche-0.24.5/datagram-socket)
error: cannot construct `msghdr` with struct literal syntax due to private fields
  --> datagram-socket/src/mmsg.rs:59:26
   |
59 |                 msg_hdr: libc::msghdr {
   |                          ^^^^^^^^^^^^
   |
   = note: ...and other private fields `__pad1` and `__pad2` that were not provided

error: cannot construct `msghdr` with struct literal syntax due to private fields
   --> datagram-socket/src/mmsg.rs:119:26
    |
119 |                 msg_hdr: libc::msghdr {
    |                          ^^^^^^^^^^^^
    |
    = note: ...and other private fields `__pad1` and `__pad2` that were not provided

   Compiling slog-stdlog v4.1.1
error: could not compile `datagram-socket` (lib) due to 2 previous errors

msghdr cannot be directly instantiated on musl due to private padding fields, the issue rust-lang/libc#2344 is marked "wontfix". Other projects have solved the issues using mem::zeroed, see anza-xyz/agave#3836 and anza-xyz/agave#4760

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