Building on Mac for an ARM64 EC2 VM

I've run rustup target add x86_64-unknown-linux-gnu but cargo build --target aarch64-unknown-linux-gnu --release fails due to missing aarch64-linux-gnu-gc.

It seems there is no direct, simple way to install that. Recommendations?

Also, I assume that, with that build command, the executable will use dynamic linking but will run fine (with no additional dependencies) on EC2 Linux (specifically the AMI is al2023-ami-2023.6.20241010.0-kernel-6.1-arm64).

My lesson here was that this is really a pain.

I used docker instead. Done.

cross-rs is the easiest tool to cross compile rust projects. it manages and sets up the correct container for you, you just need to specify the target triple. it supports both podman and docker container engine.

I went with a simpler solution, but thank you.