Skip to content

Instantly share code, notes, and snippets.

@shqld
Last active March 9, 2022 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shqld/21e78f07efb597181ae5de93e703f8ec to your computer and use it in GitHub Desktop.
Save shqld/21e78f07efb597181ae5de93e703f8ec to your computer and use it in GitHub Desktop.
cargo build for alpine linux (`aarch64-unknown-linux-musl`) on M1 Mac
# https://github.com/messense/homebrew-macos-cross-toolchains
brew tap messense/macos-cross-toolchains
brew install aarch64-unknown-linux-musl
export CC_AARCH64_UNKNOWN_LINUX_MUSL=aarch64-unknown-linux-musl-gcc
export CXX_AARCH64_UNKNOWN_LINUX_MUSL=aarch64-unknown-linux-musl-g++
export AR_AARCH64_UNKNOWN_LINUX_MUSL=aarch64-unknown-linux-musl-ar
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-unknown-linux-musl-gcc
rustup target add aarch64-unknown-linux-musl
cargo build --target aarch64-unknown-linux-musl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment