From 69235a3cd4d15f18911bd3096c94ba8337066f4c Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sun, 14 Jun 2026 12:13:48 +0800 Subject: [PATCH] docs: use cargo-zigbuild for aarch64 cross-compilation Replace the `cross` (Docker-based) cross-compile instructions with `cargo zigbuild`, which uses Zig as the linker and needs no Docker. This removes the "must run from a Docker-mountable path" restriction, so builds work directly from /Volumes/... checkouts. Pin glibc 2.31 to match Raspberry Pi OS bullseye/bookworm. Co-Authored-By: Claude Opus 4.8 (1M context) --- CLAUDE.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index fc14d0a..580e211 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,9 +9,11 @@ Transparent TCP proxy that intercepts traffic via OS firewall rules and forwards cargo build --release # Cross-compile for Linux aarch64 (e.g., Raspberry Pi) -# Requires: cargo install cross -# Must run from a path Docker can mount (e.g., ~/workspace, NOT /Volumes/) -cross build --release --target aarch64-unknown-linux-gnu +# Requires: cargo install cargo-zigbuild (+ a Zig toolchain: brew install zig) +# rustup target add aarch64-unknown-linux-gnu +# No Docker needed, so this works from any path (including /Volumes/...). +# The glibc suffix (.2.31) pins the target ABI; 2.31 covers Pi OS bullseye/bookworm. +cargo zigbuild --release --target aarch64-unknown-linux-gnu.2.31 # Binary at: target/aarch64-unknown-linux-gnu/release/trans_proxy ``` @@ -36,7 +38,7 @@ docker run --rm --privileged trans_proxy_test /app/target/release/e2e ## Deploy to remote Linux host ```bash -cross build --release --target aarch64-unknown-linux-gnu +cargo zigbuild --release --target aarch64-unknown-linux-gnu.2.31 scp target/aarch64-unknown-linux-gnu/release/trans_proxy user@host:/tmp/trans_proxy ssh user@host "sudo systemctl stop trans_proxy && sudo cp /tmp/trans_proxy /usr/local/bin/trans_proxy && sudo chmod 755 /usr/local/bin/trans_proxy && sudo systemctl start trans_proxy" ```