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.
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
x86_64targets (the default in musl-cross):
aarch64targets: 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:
can be copied to a Linux server or VM and run there.