- Install
musl-cross
brew install FiloSottile/musl-cross/musl-cross
- Add
x86_64-unknown-linux-musl
rustup target add x86_64-unknown-linux-musl
- Add the following linker configuration to
.cargo/config
[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-musl-gcc"
- Compile the command below:
CC=x86_64-linux-musl-gcc cargo build --release --target=x86_64-unknown-linux-musl