On Wed, 23 Jul 2025 07:57:02 -0500 Ashok Kaladi <ashok.k.kal...@intel.com> wrote:
> During cross-compilation, BPF build incorrectly includes header files > from the host system instead of the target sysroot. This leads to > build failures due to incompatible headers or unavailability of header > files in the host. > > Fix by using the Meson sysroot property to correctly locate and include > BPF-related headers from the cross-compilation environment. > > Fixes: d8d065045c4a ("net/tap: rewrite RSS BPF program") > Cc: step...@networkplumber.org > > Signed-off-by: Ashok Kaladi <ashok.k.kal...@intel.com> > --- > drivers/net/tap/bpf/meson.build | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/tap/bpf/meson.build b/drivers/net/tap/bpf/meson.build > index 35d7438c74..1b87d5018e 100644 > --- a/drivers/net/tap/bpf/meson.build > +++ b/drivers/net/tap/bpf/meson.build > @@ -39,13 +39,14 @@ endif > > enable_tap_rss = true > > -libbpf_include_dir = libbpf.get_variable(pkgconfig : 'includedir') > +# Determine sysroot if cross-compiling and the property exists in the > +# init files. Note that this environment variable will have to be passed > +# in as a property during meson setup. > +sysroot = meson.get_external_property('sysroot', '') > +libbpf_include_dir = sysroot + libbpf.get_variable(pkgconfig : 'includedir') > > -# The include files <linux/bpf.h> and others include <asm/types.h> > -# but <asm/types.h> is not defined for multi-lib environment target. > -# Workaround by using include directoriy from the host build environment. > machine_name = run_command('uname', '-m', check: true).stdout().strip() > -march_include_dir = '/usr/include/' + machine_name + '-linux-gnu' > +march_include_dir = sysroot + '/usr/include/' + machine_name + '-linux-gnu' Keep the comment about why uname -m is used.