-
Notifications
You must be signed in to change notification settings - Fork 43
Compiling an eBPF in docker #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I believe you are using latest nightly, which uses LLVM 20, but an older bpf-linker which uses 19. You need to install LLVM 20, not 19. |
You can use the trick of downloading LLVM 20 from Rust CI, like I did here: You basically need to:
And as @tamird said, you need to use LLVM version which matches the current Rust nightly. Attempts to use distro packaging and pinning bpf-linker or Rust toolchain to something ancient usually fails. It's better to stick to what's the newest. |
I'll try to update to LLVM 20 and the newer bpf-linker, so my understanding since I use the flag
Basically followed the readme generated from the Aya template ## Prerequisites
1. stable rust toolchains: `rustup toolchain install stable`
1. nightly rust toolchains: `rustup toolchain install nightly --component rust-src`
1. (if cross-compiling) rustup target: `rustup target add ${ARCH}-unknown-linux-musl`
1. (if cross-compiling) LLVM: (e.g.) `brew install llvm` (on macOS)
1. (if cross-compiling) C toolchain: (e.g.) [`brew install filosottile/musl-cross/musl-cross`](https://github.com/FiloSottile/homebrew-musl-cross) (on macOS)
1. bpf-linker: `cargo install bpf-linker` (`--no-default-features` on macOS) If that's the case I am now also wondering why my install of bpf-linker fails in my Docker container if I don't use I am basically trying to just make the build happen in a docker container, though using alpine. As for the nightly part, from my understanding is that you need to have nightly available for the Aya eBPF (#250) |
bpf-linker is not independent of rust, regardless of features. The LLVM IR produced by rustc is consumed by bpf-linker, so the LLVM versions must be compatible, which usually means they must be the same major version. I'm going to close this for now, please let us know if you continue to have issues. |
Hi, I been trying to compile the aya-template XDP program in side the Rust's Alpine docker container
Basically this:
Then mounting the template repo to
/app
Then it fails when linking with
bpf-linker
It then seems to re run and ends up with just about the same output but the Error being
I have tried with the newest bpf-linker without the
--no-default-features
(as the newest requires LLVM 20)Then I get some different errors when compiling and the linking happens, that I think was fixed by using the
--no-default-features
optionAs this is docker hopefully it's very easy to re-create.
Please let me know if this is generally not possible
(FYI)
Also tried with
Same issue as abvoe
The text was updated successfully, but these errors were encountered: