foniod / redbpf

Rust library for building and running BPF/eBPF modules
Apache License 2.0
1.71k stars 136 forks source link

couldn't process IR file: LLVMParseIRInContext failed #315

Closed luoffei closed 2 years ago

luoffei commented 2 years ago

I follow the example tutorial, when I run cargo bpf build --target-dir=../target I get the following error

   Compiling probes v0.1.0 (/mnt/c/files/dev/rust/redbpf-tutorial/probes)
warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type

warning: ignoring --out-dir flag due to -o flag

warning: `probes` (bin "openmonitor") generated 2 warnings
    Finished release [optimized] target(s) in 1m 32s
error: failed to compile the `openmonitor' program: couldn't process IR file: LLVMParseIRInContext failed: /mnt/c/files/dev/rust/redbpf-tutorial/target/bpf/programs/openmonitor/openmonitor-8bcef341c3f3ee3d.bc: error: Invalid record

cargo version: cargo 1.60.0 (d1fd9fe 2022-03-01) llvm version: 13.0.1 System is wsl2 ubuntu 20.04

luoffei commented 2 years ago

I switched the rust version to 1.59, and this problem is gone.