Skip to content

Instantly share code, notes, and snippets.

@AldoMX
Last active November 4, 2024 22:20
Show Gist options
  • Save AldoMX/44d7184cf343545fe5258053169423d4 to your computer and use it in GitHub Desktop.
Save AldoMX/44d7184cf343545fe5258053169423d4 to your computer and use it in GitHub Desktop.

Lock Rust version to 1.77.2

Rust 1.77.2 is the last version to support Windows 7.

rustup default 1.77.2

Cross-compile Windows x86_64 on MacOS aarch64

brew install mingw-w64
rustup target add x86_64-pc-windows-gnu
nano ~/.cargo/config.toml
[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
cargo build --release --target=x86_64-pc-windows-gnu

Cross-compile Linux x86_64 on MacOS aarch64

# See: https://github.com/messense/homebrew-macos-cross-toolchains
brew tap messense/macos-cross-toolchains
brew install x86_64-unknown-linux-gnu
nano ~/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
linker = "x86_64-linux-gnu-gcc"
cargo build --release --target=x86_64-unknown-linux-gnu

Cross-compile MacOS x86_64 on MacOS aarch64

rustup target install x86_64-apple-darwin
cargo build --release --target=x86_64-apple-darwin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment