xtask: fix include paths for kernel headers bundled with libbpf

pull/25/head
Alessandro Decina 3 years ago
parent 08c71dfeb1
commit 8cd669ca9a

@ -1,4 +1,8 @@
#include <linux/types.h> #include <linux/types.h>
// __wsum is missing from types.h, see
// https://elixir.bootlin.com/linux/v5.13/source/include/uapi/linux/types.h
typedef __u32 __bitwise __wsum;
#include <linux/bpf.h> #include <linux/bpf.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <sys/socket.h> #include <sys/socket.h>

@ -1,7 +1,5 @@
use core::{marker::PhantomData, mem}; use core::{marker::PhantomData, mem};
use aya_bpf_cty::c_void;
use crate::{ use crate::{
bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_QUEUE}, bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_QUEUE},
helpers::{bpf_map_pop_elem, bpf_map_push_elem}, helpers::{bpf_map_pop_elem, bpf_map_push_elem},

@ -22,6 +22,14 @@ fn codegen_internal_btf_bindings(opts: &Options) -> Result<(), anyhow::Error> {
.unwrap() .unwrap()
.to_string_lossy() .to_string_lossy()
)) ))
.clang_arg(format!(
"-I{}",
opts.libbpf_dir
.join("include")
.canonicalize()
.unwrap()
.to_string_lossy()
))
.header( .header(
opts.libbpf_dir opts.libbpf_dir
.join("src/libbpf_internal.h") .join("src/libbpf_internal.h")

@ -21,6 +21,11 @@ pub fn codegen(opts: &Options) -> Result<(), anyhow::Error> {
let builder = || { let builder = || {
let mut bindgen = bindgen::bpf_builder() let mut bindgen = bindgen::bpf_builder()
.header(&*dir.join("include/bindings.h").to_string_lossy()) .header(&*dir.join("include/bindings.h").to_string_lossy())
.clang_args(&[
"-I",
&*opts.libbpf_dir.join("include/uapi").to_string_lossy(),
])
.clang_args(&["-I", &*opts.libbpf_dir.join("include").to_string_lossy()])
.clang_args(&["-I", &*opts.libbpf_dir.join("src").to_string_lossy()]) .clang_args(&["-I", &*opts.libbpf_dir.join("src").to_string_lossy()])
// open aya-bpf-bindings/.../bindings.rs and look for mod // open aya-bpf-bindings/.../bindings.rs and look for mod
// _bindgen, those are anonymous enums // _bindgen, those are anonymous enums

Loading…
Cancel
Save