Skip to content

cli: cross-compile decdn for OpenWrt (aarch64/armv7 musl; MIPS32 blocked on AtomicU64) #2625

Open

Description

@thiras

Goal

Ship the decdn CLI (the client) for OpenWrt routers. OpenWrt is musl-based, and the common SoC families split into three Rust targets:

OpenWrt family Rust target Rust tier
filogic, ipq807x, rockchip, bcm27xx (64-bit) aarch64-unknown-linux-musl 2 (prebuilt std)
ipq40xx, mvebu, bcm53xx armv7-unknown-linux-musleabihf 2 (prebuilt std)
ath79, ramips (mt7621/mt7620), lantiq mipsel-unknown-linux-musl / mips-unknown-linux-musl 3 (nightly + -Zbuild-std)

The release matrix in .github/workflows/release.yml builds only glibc Linux (x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu), macOS and Windows. None of these run on an OpenWrt box.

What a local probe established (2026-10-26, toolchain 1.99.1, cargo-zigbuild 0.24.0 with zig as the C cross-compiler)

aarch64-unknown-linux-musl: the whole dependency graph compiles. 474 crates built with zero errors, including the ones that usually break on musl cross-builds: ring 0.17.14 (C sources), redb, iroh 1.3.0 / noq, netwatch, rustls, alloy. The run was stopped while decdn-cli itself was compiling, so the final link step and a binary on a real device are still unverified.

armv7-unknown-linux-musleabihf: not attempted (queued behind aarch64, stopped before it started). Same tier, same expectation, same unknowns.

mipsel-unknown-linux-musl: will not compile as-is. The target spec is 32-bit, soft-float, max-atomic-width: 32. Our own crates use std::sync::atomic::AtomicU64 directly, which does not exist on that target:

  • crates/client/src/driver.rs (unbilled_from, verified, frontier, progress and stop counters)
  • crates/client/src/stream_cap.rs (next_lane)
  • crates/client/src/lane_sources.rs (seeded)
  • crates/client/src/progress.rs (byte counters)
  • crates/client/src/downloader.rs
  • crates/protocol

The same pattern appears in dependencies that have no target_has_atomic fallback: iroh, iroh-dns, iroh-relay, iroh-metrics, noq-proto, redb, alloy-primitives, alloy-rpc-client, indicatif, rustls. (tokio, crossbeam-utils, serde, zerocopy already gate on target_has_atomic = "64" or route through portable-atomic.) Fixing our crates is a portable-atomic swap; the upstream list means MIPS32 is a multi-upstream effort, not a target we can add in one PR.

Work items

  1. Finish the aarch64-musl and armv7-musl builds to a linked decdn binary, run decdn --version and a paid decdn get on a real OpenWrt device (or qemu). Record stripped release size: typical OpenWrt flash is 16 to 128 MB, so size may decide whether this ships as an opkg/apk package or only as a USB/extroot install.
  2. Decide the build mechanism for the release workflow: cargo-zigbuild (one runner, zig links musl), cross (Docker images per target), or the musl-tools native path for x86_64 only. The glibc aarch64-unknown-linux-gnu entry already cross-compiles on ubuntu-latest, so the matrix shape exists.
  3. Add aarch64-unknown-linux-musl and armv7-unknown-linux-musleabihf to the release matrix and to the self-update target table, once (1) passes.
  4. MIPS32 (mipsel/mips): file as a separate follow-up after (3). Needs portable-atomic in decdn-client and decdn-protocol, nightly -Zbuild-std, and upstream fixes or forks for the crates listed above. Do not block the aarch64/armv7 work on it.

Reproduce the probe

rustup target add aarch64-unknown-linux-musl armv7-unknown-linux-musleabihf
uvx --from cargo-zigbuild cargo-zigbuild zigbuild --target aarch64-unknown-linux-musl -p decdn-cli --bin decdn --release
# MIPS target facts
rustc +nightly -Z unstable-options --print target-spec-json --target mipsel-unknown-linux-musl | grep -E 'features|max-atomic-width'

Activity

  1. added
    kind:feature
    area:cli
    prio:low
    area:ci
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciarea:clikind:featureprio:low

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions