Skip to content

Cross-compile on Apple Silicon

Use Zig plus Rust's Linux target. This stays lightweight on a MacBook and does not need a VM.

One-time setup

brew install zig
cargo install cargo-zigbuild
rustup target add x86_64-unknown-linux-gnu

Build Linux x86_64 binaries

Debug build:

make build-linux-x86

Release build:

make build-linux-x86-release

Artifacts land in:

target/x86_64-unknown-linux-gnu/debug/
target/x86_64-unknown-linux-gnu/release/

Default packages:

  • sqltamer-cli
  • sqltamer-server

Default target:

  • x86_64-unknown-linux-gnu.2.17

That glibc floor keeps the output usable on older Linux distributions without pulling in a full container or VM.

Override the target or package set

Build one package only:

make build-linux-x86-release LINUX_X86_PACKAGES='-p sqltamer-cli'

Build for a different glibc floor:

make build-linux-x86-release LINUX_X86_TARGET=x86_64-unknown-linux-gnu.2.28

TLS note

The workspace uses reqwest with rustls plus native root certificates for cross-builds. That avoids the usual Linux OpenSSL sysroot problem when building from macOS.