From 11fc3be726a1f9d12a9c9564ab0542b5f5460019 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sat, 13 Jun 2026 01:12:56 +0200 Subject: [PATCH] =?UTF-8?q?fix(core):=20libc=20is=20a=20unix-wide=20dep=20?= =?UTF-8?q?=E2=80=94=20unbreak=20iOS/tvOS=20xcframework=20slices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6b5ee9f added a libc-based batched recv_batch for the Apple/BSD targets (cfg(all(unix, not(target_os = "linux")))) but left libc declared only under cfg(target_os = "linux"). The macOS host build pulls libc in transitively so it compiled, but the iOS/tvOS cross-compiles (no transitive libc, dev-deps off) failed with E0433 "cannot find crate libc", breaking the full xcframework build. Widen the gate to cfg(unix): libc is now used by sendmmsg/recvmmsg on Linux AND recv() on the other unix (Apple/BSD) targets. Verified: cargo build --release -p punktfunk-core --features quic for aarch64-apple-ios, x86_64-apple-ios, and aarch64-apple-tvos (-Z build-std) all link. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/punktfunk-core/Cargo.toml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/punktfunk-core/Cargo.toml b/crates/punktfunk-core/Cargo.toml index 5f7390a..35422e0 100644 --- a/crates/punktfunk-core/Cargo.toml +++ b/crates/punktfunk-core/Cargo.toml @@ -46,9 +46,12 @@ hmac = { version = "0.12", optional = true } spake2 = { version = "0.4", optional = true } tokio = { version = "1", optional = true, features = ["rt-multi-thread", "net", "sync", "macros"] } -# `sendmmsg` batched UDP send (the 1 Gbps+ syscall lever) — Linux only; other targets use the -# scalar `send` loop fallback. -[target.'cfg(target_os = "linux")'.dependencies] +# `libc` for batched UDP syscalls: `sendmmsg`/`recvmmsg` on Linux (the 1 Gbps+ lever) and the +# `recv(MSG_DONTWAIT)` drain on the other unix (Apple/BSD) targets, which have no `recvmmsg` +# (see transport/udp.rs `recv_batch`). Needed on every unix target — non-unix (Windows) uses +# the scalar fallbacks. Cross-compiles (iOS/tvOS) don't pull libc transitively the way the +# macOS host build does, so it must be a direct dep here or those slices fail to link `libc::`. +[target.'cfg(unix)'.dependencies] libc = "0.2" [dev-dependencies]