Cross-compiling aya-based programs
The instructions below show how to cross compile aya eBPF programs on Macs. Cross compiling on other systems is possible too and we're going to add instructions to do that soon (PRs welcome!).
Cross-compiling aya-based programs on Mac
Cross compilation should work on both Intel and Apple Silicon Macs.
- Install 
rustupfollowing the instructions on https://rustup.rs/ - Install the stable and nightly rust toolchains:
 - Install the rustup target for your Linux target platform:
 - 
Install LLVM with brew:
 - 
Install the musl cross compiler:
to cross-compile for only
to cross-compile for onlyx86_64targets (the default in musl-cross):aarch64targets: to cross-compile for bothx86_64andaarch64targets: See homebrew-musl-cross for additional platform-specific options. - 
Install bpf-linker. Change the version number in
LLVM_SYS_<version>_PREFIXto correspond to the major version of the llvm-sys crate: 
RUSTFLAGS="-Clinker=${ARCH}-linux-musl-ld" cargo build --release --target=${ARCH}-unknown-linux-musl
target/${ARCH}-unknown-linux-musl/release/<program_name>can be copied to a Linux server or VM and run there.