cloudflare / cloudflare/quiche

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

Open Beginner friendly
#2,222 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
11.8k
Forks
1.1k
Avg merge
3d 7h
Merged PRs (30d)
16

Description

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 https://github.com/rust-lang/libc/issues/2344 is marked "wontfix". Other projects have solved the issues using `mem::zeroed`, see https://github.com/anza-xyz/agave/pull/3836 and https://github.com/anza-xyz/agave/pull/4760

Contributor guide

Open the contributing guide

Research direction

Start with datagram-socket/src/mmsg.rs at lines 59 and 119, where libc::msghdr is constructed, and review the musl padding-field error alongside the linked libc and Agave references. Reproduce the build with Rust 1.90 and libc 0.2.177 on Alpine Linux; done means datagram-socket compiles successfully without the msghdr construction errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.