Migrate to the pure-Rust rs_abieos backend (cross-platform) - #2
Conversation
Switch the rs_abieos dependency to 0.5.0 with the pure-Rust `rust-backend`
(default-features = false). The backend is API-compatible, so this needs zero
code changes — but it removes the C++ toolchain / clang / libclang / git build
requirements and makes fleet-router build and run on Linux, macOS, and Windows.
- Cargo.toml: rs_abieos = { version = "0.5.0", default-features = false,
features = ["rust-backend"] }. MSRV raised to 1.95 (rs_abieos uses `if let`
guards, stable since 1.95). Cargo.lock drops bindgen/cc/clang-sys/sys-info.
- CI: replace the single Linux job (which installed clang/libclang) with a
Linux/macOS/Windows test matrix; MSRV job -> 1.95; bump actions to Node 24.
- release.yml: build cross-platform release binaries (linux x86_64, macOS
arm64/x86_64, windows x86_64) alongside the crates.io publish and GHCR image.
- Dockerfile: drop the clang/libclang install; builder is rust:1.95-bookworm.
- tests: locate the binary via CARGO_BIN_EXE_fleet-router so the e2e and
operational suites run on Windows/macOS too.
- docs: README/CONTRIBUTING/SECURITY/bug-report updated for pure-Rust,
cross-platform builds; CHANGELOG entry.
Verified: native Windows build + full test suite; Linux fmt/clippy/test/
cargo-deny; MSRV 1.95; docker build (pure Rust, no clang).
There was a problem hiding this comment.
Code Review
This pull request transitions fleet-router to a pure-Rust implementation by upgrading rs_abieos to version 0.5.0 with the rust-backend feature enabled. This change removes the dependency on a C/C++ toolchain, clang, and libclang, allowing native builds on Linux, macOS, and Windows (x86_64 and arm64). Consequently, the Minimum Supported Rust Version (MSRV) is bumped to 1.95, and the Dockerfile, issue templates, and documentation are updated. In the integration tests, manual binary path resolution is replaced with Cargo's binary environment variables. However, the reviewer identified a critical issue where using CARGO_BIN_EXE_fleet-router will cause compilation errors because Cargo replaces dashes with underscores in target names; this needs to be updated to CARGO_BIN_EXE_fleet_router in both test files.
| // Cargo builds the binary before running this integration test and sets | ||
| // CARGO_BIN_EXE_<name> to its absolute path, with the platform's | ||
| // executable extension (e.g. `.exe` on Windows). | ||
| env!("CARGO_BIN_EXE_fleet-router").to_string() |
There was a problem hiding this comment.
Cargo replaces dashes (-) with underscores (_) in the environment variable names generated for binary targets. Therefore, CARGO_BIN_EXE_fleet-router does not exist, and using it will cause a compilation error. It should be CARGO_BIN_EXE_fleet_router instead.
| env!("CARGO_BIN_EXE_fleet-router").to_string() | |
| env!("CARGO_BIN_EXE_fleet_router").to_string() |
There was a problem hiding this comment.
False positive — keeping CARGO_BIN_EXE_fleet-router (with the hyphen).
Cargo sets CARGO_BIN_EXE_<name> using the binary target name verbatim; the dash is not converted to an underscore. The Cargo Book example is literally CARGO_BIN_EXE_my-program. (The dash→underscore rule applies to CARGO_FEATURE_* / CARGO_CFG_*, not CARGO_BIN_EXE_*.)
Evidence: the suggested CARGO_BIN_EXE_fleet_router fails to compile —
error: environment variable `CARGO_BIN_EXE_fleet_router` not defined at compile time
whereas the hyphenated form compiles and the e2e/operational suites run on Linux, macOS, and Windows (this PR's CI is green on all three). Applying the suggestion would break the build.
| // Cargo builds the binary before running this integration test and sets | ||
| // CARGO_BIN_EXE_<name> to its absolute path, with the platform's executable | ||
| // extension (e.g. `.exe` on Windows). | ||
| env!("CARGO_BIN_EXE_fleet-router").to_string() |
There was a problem hiding this comment.
Cargo replaces dashes (-) with underscores (_) in the environment variable names generated for binary targets. Therefore, CARGO_BIN_EXE_fleet-router does not exist, and using it will cause a compilation error. It should be CARGO_BIN_EXE_fleet_router instead.
| env!("CARGO_BIN_EXE_fleet-router").to_string() | |
| env!("CARGO_BIN_EXE_fleet_router").to_string() |
There was a problem hiding this comment.
False positive — keeping CARGO_BIN_EXE_fleet-router (with the hyphen).
Cargo sets CARGO_BIN_EXE_<name> using the binary target name verbatim; the dash is not converted to an underscore. The Cargo Book example is literally CARGO_BIN_EXE_my-program. (The dash→underscore rule applies to CARGO_FEATURE_* / CARGO_CFG_*, not CARGO_BIN_EXE_*.)
Evidence: the suggested CARGO_BIN_EXE_fleet_router fails to compile —
error: environment variable `CARGO_BIN_EXE_fleet_router` not defined at compile time
whereas the hyphenated form compiles and the e2e/operational suites run on Linux, macOS, and Windows (this PR's CI is green on all three). Applying the suggestion would break the build.
Summary
Switches the
rs_abieosdependency to 0.5.0 with the pure-Rustrust-backend(default-features = false). The backend is API-compatible, so this is a zero-code-change migration — but it drops the C++ toolchain /clang/libclang/gitbuild requirements and makes fleet-router build, test, and run on Linux, macOS, and Windows.This is the change that lets fleet-router ship as a normal cross-platform crate (
cargo install fleet-routernow works everywhere) instead of being Linux-only.Changes
Cargo.toml:rs_abieos = { version = "0.5.0", default-features = false, features = ["rust-backend"] }.Cargo.lockdropsbindgen/cc/clang-sys/sys-info(−128 lines).rs_abieos's pure-Rust backend usesif letguards, stable since Rust 1.95 (verified: 1.95 builds, 1.94 does not). Updatedrust-version, the CI MSRV job, README, and CONTRIBUTING.clang/libclang) with a Linux/macOS/Windows test matrix; split out fmt/clippy; bumped actions to Node 24 (checkout@v5).release.yml: now builds cross-platform release binaries (linux x86_64, macOS arm64 + x86_64, windows x86_64) alongside the crates.io publish and GHCR image.Dockerfile: dropped theclang/libclanginstall; builder isrust:1.95-bookworm(pure-Rust build).env!("CARGO_BIN_EXE_fleet-router")so the e2e/operational suites run on Windows/macOS (not just the Unixtarget/debug/fleet-routerpath).Verification
cargo build --all-targets✓ and fullcargo test --workspace✓ (12 e2e, 5 mock-integration, 3 operational, 6 conformance, 3 stress, 6 mock-ship).cargo fmt --check,clippy --locked -D warnings,cargo test --workspace --locked,cargo-deny(advisories/bans/licenses/sources) — all ✓.cargo +1.95 check --locked✓.docker build✓ (pure Rust, no clang,rust:1.95-bookworm).Notes
rs_abieosusingif letguards. If a lower MSRV matters, that one construct inrs_abieos'scrypto.rscould be rewritten upstream to restore a lower floor. The committedCargo.lockpinsrs_abieos 0.5.0, so the MSRV won't drift unexpectedly.