aya-rs/book

How to use the binaries built, calling them by themselves, out of the context of cargo?

Closed this issue · 2 comments

je-vv commented

By following the Hello XDP! section on the book, one ends up with 2 binaries:

  • user space -> target/debug/myapp
  • ebpf -> target/bpfel-unknown-none/debug/myapp

well, actually a 3rd one:

  • target/debug/xtask

And one can execute the user space one through cargo xtask run according to the documentation. Is there a way to execute the binaries out of the context of cargo? Meaning just executing the binaries... Or are the user space executables always bound to be used with cargo?

je-vv commented

Ohh, I just missed the verbosity level when trying, but this works:

RUST_LOG=info ./target/debug/xtask run

is there a way to execute the binaries out of the context of cargo? Meaning just executing the binaries...

of course - cargo xtask run is just a convenient, you can also run sudo ./target/debug/xdp-hello without cargo (or copy it to other servers, and run it there, or package that binary into a docker image etc.). The "ebpf binary" target/bpfel-unknown-none/debug/myapp is not an executable - you cannot run it by itself - it is a BPF object file that gets included into the user-space binary