-
Notifications
You must be signed in to change notification settings - Fork 136
Segmentation fault in simple ebpf program #213
Comments
@sebastiaoamaro Do you experience Segfault while compiling BPF programs? |
@sebastiaoamaro I used to experience segfault while compiling BPF programs if versions mismatch between rust and LLVM. The latest stable rust depends on LLVM 13. But compiling BPF programs will fail if your system has LLVM 12 libraries. |
You can check your rustc uses which version of LLVM by executing this: $ rustc -vV
rustc 1.55.0 (c8dfcfe04 2021-09-06)
binary: rustc
commit-hash: c8dfcfe046a7680554bf4eb612bad840e7631c4b
commit-date: 2021-09-06
host: x86_64-unknown-linux-gnu
release: 1.55.0
LLVM version: 12.0.1 And you can check the version of LLVM in your system by running this command: $ llvm-config --version
12.0.1 |
Hello @sebastiaoamaro |
Thanks for the responses!
And my llvm-config --version: I get the error: When running cargo install cargo-bpf. |
I created a new ubuntu (21.10) with only llvm13, and this time I get:
--> /home/sebasamaro/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/llvm-sys-120.2.1/src/lib.rs:486:1 When running llvm-13-config: I also tried installing with llvmenv, however their build is not working. |
There were two options you could choose.
It seems that you chose option no. 2 $ cargo build --no-default-features --features=llvm13 Currently, RedBPF uses LLVM12 as a default LLVM version. But you can change the version by the command above. Or you can specify the feature through Please refer to valid combination of rust and llvm versions for more information. If you have any problem please let me know. |
I understand that step when building bpf programs, but I am still stuck on installing (cargo install cargo-bpf). |
If i install running cargo install cargo-bpf --no-default-features --features=llvm13 then I get: error[E0425]: cannot find function Because some default features need to be installed. |
@sebastiaoamaro $ cargo install cargo-bpf --no-default-features --features=llvm13,command-line Please, see Thank you |
It makes sense yes, maybe changing the tutorial so that other users don't get the same error would be good. |
@sebastiaoamaro Thank you |
A few users had struggled with problems originated from RedBPF. And they asked how to solve the tricky problems via github issues. The updated content consists of answers to issues as below: - #213 - #194 - #212 - #205 Thanks to users effort and their report, this content can be written. Signed-off-by: Junyeong Jeong <rhdxmr@gmail.com>
@sebastiaoamaro |
A few users had struggled with problems originated from RedBPF. And they asked how to solve the tricky problems via github issues. The updated content consists of answers to issues as below: - #213 - #194 - #212 - #205 Thanks to users effort and their report, this content can be written. Signed-off-by: Junyeong Jeong <rhdxmr@gmail.com>
@rhdxmr Thank you so much for your comments. I've been trying to install this for a while. Did not find anyway around. I was stuck with this error. |
Running a program based on https://github.com/foniod/redbpf/blob/main/examples/example-probes/src/tcp_lifetime/main.rs with code:
The text was updated successfully, but these errors were encountered: