Skip to content

Commit

Permalink
improve(build): error out if build commands not exit with success
Browse files Browse the repository at this point in the history
  • Loading branch information
EHfive committed Nov 22, 2024
1 parent 6d9f6ee commit d9ce880
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ fn einat_obj_build() {
"bpfeb"
};

cmd.arg("-target")
let res = cmd
.arg("-target")
.arg(target)
.arg("-g")
.arg("-O2")
Expand All @@ -81,13 +82,19 @@ fn einat_obj_build() {
.arg(bpf_obj)
.status()
.expect("compile BPF object failed");
if !res.success() {
panic!("{}", res);
}

// strip the DWARF debug information
Command::new("llvm-strip")
let res = Command::new("llvm-strip")
.arg("--strip-debug")
.arg(bpf_obj)
.status()
.expect("llvm-strip BPF object file failed");
if !res.success() {
panic!("{}", res);
}
}

#[cfg(feature = "libbpf-skel")]
Expand All @@ -112,4 +119,5 @@ fn main() {
libbpf_skel_build();

println!("cargo:rerun-if-changed={}", SRC_DIR);
println!("cargo:rerun-if-changed=build.rs");
}

0 comments on commit d9ce880

Please sign in to comment.