Skip to content

Commit

Permalink
xtask: corrected bpf to ebpf for path to aya-ebpf-bindings in codegen
Browse files Browse the repository at this point in the history
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: aya-rs#914
  • Loading branch information
tyrone-wu authored and tamird committed Apr 1, 2024
1 parent b552c83 commit b23973d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions xtask/src/codegen/aya.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions xtask/src/codegen/aya_ebpf_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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::<syn::File>(&bindings).unwrap();
Expand Down

0 comments on commit b23973d

Please sign in to comment.