From b23973dd9ccc0f04d3f5916116c7cf244bc3189e Mon Sep 17 00:00:00 2001 From: tyrone-wu Date: Mon, 1 Apr 2024 05:00:03 +0000 Subject: [PATCH] xtask: corrected bpf to ebpf for path to aya-ebpf-bindings in codegen Currently, when running `cargo +nightly xtask codegen` locally and in the codegen GHA workflow, an error occurs with only "Error: bindgen failed" displayed. This was due to a path using "bpf/..." instead of "ebpf/...". It is now corrected to "ebpf", and bindgen fails should now display a more direct message on why it failed. Fixes: #914 --- xtask/src/codegen/aya.rs | 4 ++-- xtask/src/codegen/aya_ebpf_bindings.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xtask/src/codegen/aya.rs b/xtask/src/codegen/aya.rs index 7556cab6..be447bd5 100644 --- a/xtask/src/codegen/aya.rs +++ b/xtask/src/codegen/aya.rs @@ -42,7 +42,7 @@ fn codegen_internal_btf_bindings(libbpf_dir: &Path) -> Result<(), anyhow::Error> let bindings = bindgen .generate() - .map_err(|_| anyhow!("bindgen failed"))? + .map_err(|op| anyhow!("bindgen failed - {op}"))? .to_string(); // write the bindings, with the original helpers removed @@ -216,7 +216,7 @@ fn codegen_bindings(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyh let bindings = bindgen .generate() - .map_err(|_| anyhow!("bindgen failed"))? + .map_err(|op| anyhow!("bindgen failed - {op}"))? .to_string(); // write the bindings, with the original helpers removed diff --git a/xtask/src/codegen/aya_ebpf_bindings.rs b/xtask/src/codegen/aya_ebpf_bindings.rs index 09f0d931..ced98b15 100644 --- a/xtask/src/codegen/aya_ebpf_bindings.rs +++ b/xtask/src/codegen/aya_ebpf_bindings.rs @@ -19,7 +19,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E riscv64_sysroot, } = opts; - let dir = PathBuf::from("bpf/aya-ebpf-bindings"); + let dir = PathBuf::from("ebpf/aya-ebpf-bindings"); let builder = || { let mut bindgen = bindgen::bpf_builder() @@ -95,7 +95,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E let bindings = bindgen .generate() - .map_err(|_| anyhow!("bindgen failed"))? + .map_err(|op| anyhow!("bindgen failed - {op}"))? .to_string(); let mut tree = parse_str::(&bindings).unwrap();