Compilation failures when targeting musl
mrakh opened this issue · 0 comments
mrakh commented
When compiling this library using the x86_64-unknown-linux-musl
target, I get these errors:
cannot find type `statx` in crate `libc`
cannot construct `msghdr` with struct literal syntax due to private fields
The first error occurs because struct statx
is not defined in musl and therefore has no exposed definition in the libc crate when the target is set to musl. This can be fixed by vendoring the statx struct definition and replacing all uses of libc::statx
in glommio.
The second error occurs because glommio uses struct literal syntax to initialize the mgshdr structs - when targeting musl, the libc
crate marks the msghdr struct's padding fields as private, so they cannot be explicitly assigned to. This can be fixed by initializing the msghdr structs using std::mem::zeroed()
instead of the struct literal syntax.