You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
netwatch fails to build for iOS with libc >= 0.2.190 (route constants are macOS-only now) #261
netwatch 0.19.3 / 0.20.0 fails to build for aarch64-apple-ios with libc >= 0.2.190. That libc release removed the routing socket constants (RTM_*, RTF_IFSCOPE, RTAX_*, …) from non-macOS Apple targets (rust-lang/libc#5158), and interfaces/bsd/macos.rs / netmon/bsd.rs use them on iOS too. With libc 0.2.189 it builds fine.
netdev 0.46.x had the same issue, which is fixed in netdev 0.47.0, but netwatch still requires 0.46.3.
We hit this through iroh in an iOS app and are capping libc at <0.2.190 for now.
Repro and full error list
[package]
name = "repro"version = "0.1.0"edition = "2024"
[dependencies]
netwatch = "=0.20.0"libc = "=0.2.191"# Only to get past the separate netdev error, so the netwatch errors show up.
[patch.crates-io]
netdev = { git = "https://github.com/shellrow/netdev", rev = "b3bfb0fb5595cd143bfa0b9f07d1ad6e0ef0c313" }
cargo check --target aarch64-apple-ios # Rust 1.97.0
...
error: could not compile `netwatch` (lib) due to 22 previous errors
I have a fix ready, following what bsd/freebsd.rs etc. already do: define the Apple routing constants locally in bsd/macos.rs instead of taking them from libc, plus a macOS-only test asserting they match libc's values. Also bumps netdev to 0.47 (and libc to 0.2.191 in the lockfile, since the current lock is on 0.2.189 so CI doesn't see this). Checked with cargo check --target aarch64-apple-ios and the netwatch tests on macOS.
Happy to open a PR if this approach works for you.
We hit this building iroh for an iOS app. One thing we found while testing: netdev 0.47 with its default gateway feature still goes through os::darwin::route::get_gateway_map on iOS, so it relies on the same Darwin routing ABI that libc stopped exposing there.
We have a branch that sidesteps it on iOS: Network.framework (nw_path_monitor) for path changes and gateways, getifaddrs for addresses, no netdev on iOS, public API unchanged. It passes on the iOS 26.5/27 simulators and links for arm64 devices; macOS and Linux are untouched. Physical handoffs aren't tested yet.
@R44VC0RP netdev 0.47 hardcodes these constants and declares sysctl itself, so it builds on iOS again. What libc removed is the header-level definitions; the routing sysctl itself is what netwatch and netdev have been using on iOS all along. This PR does the same in netwatch. Moving iOS to Network.framework seems like a bigger change that's worth its own issue.
Activity
Foreverwzh commentedon Oct 27, 2026
I have a fix ready, following what
bsd/freebsd.rsetc. already do: define the Apple routing constants locally inbsd/macos.rsinstead of taking them from libc, plus a macOS-only test asserting they match libc's values. Also bumps netdev to 0.47 (and libc to 0.2.191 in the lockfile, since the current lock is on 0.2.189 so CI doesn't see this). Checked withcargo check --target aarch64-apple-iosand the netwatch tests on macOS.Happy to open a PR if this approach works for you.
flub commentedon Oct 27, 2026
Hey, thanks for the report. Would be great to get a PR for this. Let's upgrade to netdev 0.47 for this. Thanks!
R44VC0RP commentedon Oct 31, 2026
We hit this building iroh for an iOS app. One thing we found while testing: netdev 0.47 with its default gateway feature still goes through
os::darwin::route::get_gateway_mapon iOS, so it relies on the same Darwin routing ABI that libc stopped exposing there.We have a branch that sidesteps it on iOS: Network.framework (
nw_path_monitor) for path changes and gateways,getifaddrsfor addresses, no netdev on iOS, public API unchanged. It passes on the iOS 26.5/27 simulators and links for arm64 devices; macOS and Linux are untouched. Physical handoffs aren't tested yet.https://github.com/anomalyco/net-tools/tree/ios-network-framework
Happy to open it as a PR if that direction is useful, or to keep it on our side if the netdev 0.47 route covers iOS for you.
Foreverwzh commentedon Nov 1, 2026
Opened #267.
@R44VC0RP netdev 0.47 hardcodes these constants and declares
sysctlitself, so it builds on iOS again. What libc removed is the header-level definitions; the routing sysctl itself is what netwatch and netdev have been using on iOS all along. This PR does the same in netwatch. Moving iOS to Network.framework seems like a bigger change that's worth its own issue.fix(netwatch): define Darwin routing constants locally for iOS
iOS: pin libc to 0.2.189, set the signing team
fix(netwatch): define Darwin routing constants locally for iOS (n0-co…
feat(mobile): kriyon-mobile, the phone's Rust library over UniFFI
OutThisLife commentedon Nov 17, 2026
Is a netwatch 0.19.x patch release with #267 planned? iroh 1.4.x requires
^0.19.3, so it can't build for iOS with libc >= 0.2.190 until either that or an iroh on netwatch 0.20.1 ships. Cherry-pick ontonetwatch-v0.19.3: https://github.com/OutThisLife/net-tools/tree/netwatch-0.19-ios