Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Last active June 2, 2022 19:41
Show Gist options
  • Save rummelonp/5b72da12ee9c41048836d9f71cb29c1e to your computer and use it in GitHub Desktop.
Save rummelonp/5b72da12ee9c41048836d9f71cb29c1e to your computer and use it in GitHub Desktop.
Rust で Linux 向けのやつも Mac でビルドする
# $ cargo install cross
# $ rustup target add aarch64-apple-darwin
# $ rustup target add x86_64-apple-darwin
# $ rustup target add aarch64-unknown-linux-gnu
# $ rustup target add x86_64-unknown-linux-gnu
# $ brew tap messense/homebrew-macos-cross-toolchains
# $ brew install aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu
export CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnu-gcc
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-unknown-linux-gnu-gcc
export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc
cross build --release --target aarch64-apple-darwin
cross build --release --target x86_64-apple-darwin
cross build --release --target aarch64-unknown-linux-gnu
cross build --release --target x86_64-unknown-linux-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment