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

How to see full BPF build errors? #511

Closed
akshatagarwl opened this issue Jul 11, 2023 · 5 comments
Closed

How to see full BPF build errors? #511

akshatagarwl opened this issue Jul 11, 2023 · 5 comments

Comments

@akshatagarwl
Copy link

akshatagarwl commented Jul 11, 2023

Currently if my BPF program is not valid and I try to build it I don't get the full errors. Just this:

error: failed to run custom build command for `project v0.1.0 (/home/akshat/wrkspc/project)`

Caused by:
  process didn't exit successfully: `/home/akshat/wrkspc/project/target/debug/build/project-f2b462afc857728b/build-script-build` (exit status: 101)
  --- stderr
  libbpf: failed to find BTF info for global/extern symbol 'get_details'
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Build("Failed to strip object file /tmp/nix-shell.ehZiWP/.tmpkJ2AEc/project.o")', build.rs:14:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To see the full errors I can do a

clang -target bpf -D __TARGET_ARCH_x86 -I/home/akshat/wrkspc/project/target/debug/build/libbpf-sys-9d5531770fa8ac90/out/include/ -Wall -O2 -g -fno-stack-protector -o project.bpf.o -c project.bpf.c

But this adds an extra step during the development process which is not directly in line with the usual cargo build route

@danielocfb
Copy link
Collaborator

Please provide an example reproducing the problem.

@taikulawo
Copy link
Contributor

on v0.21.1 it will print command line args when failed but it hidden by to_string
#513

@danielocfb
Copy link
Collaborator

#513 has been merged.

@akshat-aurva
Copy link

akshat-aurva commented Jul 28, 2023

@danielocfb This still doesn't seem to work bases on the build.rs provided in the PR. Can you provide a minimal example where I can see this?

@danielocfb
Copy link
Collaborator

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

4 participants