70 %

Toast is in Beta!Learn more →

Chris Biscardi

Building static Rust binaries with rustlang 1.48+

To build a statically linked Rust executable before v1.48 you could use musl libc (the same library alpine uses). As of 1.48 we can use glibc.

cargo-build-static
rust
RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-unknown-linux-gnu --release

Note that doing anything like DNS resolutions (that requires NSS) will still require matching libraries