Skip to content
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

failure linking module perf_event template in bpf-linker #217

Open
yskelg opened this issue Aug 7, 2024 · 2 comments
Open

failure linking module perf_event template in bpf-linker #217

yskelg opened this issue Aug 7, 2024 · 2 comments

Comments

@yskelg
Copy link

yskelg commented Aug 7, 2024

Following the README guide, you need to install bpf-linker on the aarch64 environment as follows.

Right, I've been tested aya-rs on my Apple M2 VMware Fusion Eenvironment with Fedora 40.

$ uname -a
Linux fedora 6.11.0-0.rc1.20240729gitdc1c8034e31b.16.fc41.aarch64+debug #1 SMP PREEMPT_DYNAMIC Tue Jul 30 05:03:16 KST 2024 aarch64 GNU/Linux

I have confirmed that this works well with the XDP template.

If your target is aarch64-unknown-linux-gnu (i.e. Linux on Apple Silicon) you will have to use the external LLVM method.

So, I build with external LLVM method option.

$ cargo install bpf-linker --no-default-features

But, there seems to be error: failure linking module /home/paran/perf-aya-rs/perf-aya-rs-ebpf/../target/bpfel-unknown-none/debug/deps/perf_aya_rs-58caae9717f08677.perf_aya_rs.4b0d608d0cf878c2-cgu.0.rcgu.o

This is my log when linking failed.

$ cargo generate https://github.com/aya-rs/aya-template
⚠️   Favorite `https://github.com/aya-rs/aya-template` not found in config, using it as a git repository: https://github.com/aya-rs/aya-template
🤷   Project Name: perf-aya-rs
🔧   Destination: /home/paran/perf-aya-rs ...
🔧   project-name: perf-aya-rs ...
🔧   Generating template ...
✔ 🤷   Which type of eBPF program? · perf_event
🔧   Moving generated files into: `/home/paran/perf-aya-rs`...
🔧   Initializing a fresh Git repository
✨   Done! New project created /home/paran/perf-aya-rs

$ cd perf-aya-rs/
$ cargo xtask build-ebpf
   ...
   Compiling xtask v0.1.0 (/home/paran/perf-aya-rs/xtask)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 45.50s
     Running `target/debug/xtask build-ebpf`
   ...
   Compiling core v0.0.0 (/home/paran/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   ...
   Compiling rustc-std-workspace-core v1.99.0 (/home/paran/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   ...
   Compiling perf-aya-rs-common v0.1.0 (/home/paran/perf-aya-rs/perf-aya-rs-common)
   Compiling aya-log-ebpf v0.1.0
   Compiling perf-aya-rs-ebpf v0.1.0 (/home/paran/perf-aya-rs/perf-aya-rs-ebpf)
error: linking with `bpf-linker` failed: exit status: 2
  |
  = note: LC_ALL="C" PATH="/home/paran/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/home/paran/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/home/paran/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/home/paran/.cargo/bin:/home/paran/.local/bin:/home/paran/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/paran/bin:/home/paran/usr/bin:/home/paran/bin:/home/paran/usr/bin" VSLANG="1033" "bpf-linker" "--export-symbols" "/tmp/rustcW2rljA/symbols" "/tmp/rustcW2rljA/symbols.o" "/home/paran/perf-aya-rs/perf-aya-rs-ebpf/../target/bpfel-unknown-none/debug/deps/perf_aya_rs-58caae9717f08677.perf_aya_rs.4b0d608d0cf878c2-cgu.0.rcgu.o" "--cpu" "generic" "-o" "/home/paran/perf-aya-rs/perf-aya-rs-ebpf/../target/bpfel-unknown-none/debug/deps/perf_aya_rs-58caae9717f08677" "-O3" "--debug"
  = note: error: failure linking module /home/paran/perf-aya-rs/perf-aya-rs-ebpf/../target/bpfel-unknown-none/debug/deps/perf_aya_rs-58caae9717f08677.perf_aya_rs.4b0d608d0cf878c2-cgu.0.rcgu.o

error: could not compile `perf-aya-rs-ebpf` (bin "perf-aya-rs") due to 1 previous error
thread 'main' panicked at xtask/src/build_ebpf.rs:65:5:
assertion failed: status.success()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Do you know anyone who could help with this, or could you provide some hints for debugging it myself?

I think it would be great if I could looking into it and contribute to this issue.

@OmriSteiner
Copy link

I ran into this earlier. I believe this is due to Rust nightly upgrading to LLVM 19 and bpf-linker using LLVM 18.
#214 was merged and a new version of bpf-linker is available, so that should probably solve it.
Either that or roll back to rust nightly 2024-07-31 (or earlier).

@vadorovsky
Copy link
Member

@yskelg Can you check again with the newest bpf-linker (0.9.13)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants