Skip to content

Issue with building kern side of code. #48

@0xMimir

Description

@0xMimir

To build kern side of bpf debugger, this build script is used,

First part of script which is commented out executes this command:

CARGO_TARGET_DIR=target/bpf cargo +nightly-2022-10-10 rustc --package=bpf-recorder --bin=bpf-recorder-kern --features=kern --no-default-features --target=bpfel-unknown-none -Z build-std=core --release -- -Cdebuginfo=2 -Clink-arg=--disable-memory-builtins -Clink-arg=--keep-btf

Second part of script executes this command:

sed -i s/ty__/type/g bpfel-unknown-none/release/bpf-recorder-kern

First part being commented out, means that sed command can be ran on outdated code, or that it doesn't get ran on new code,
This can lead to following error:

libbpf: map 'event_queue': unknown field 'ty__'.
libbpf: failed to initialize skeleton BPF object 'bpf-recorder': -95
thread 'main' panicked at bpf-recorder/src/main.rs:1184:32:
failed to open bpf: -95
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Simple fix is to add following line to build.rs

println!("cargo:rerun-if-changed={}", target_dir);

But better solution would be to fix first step, which currently works when ran outside script but not in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions