DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/tap: fix BPF build failure in cross-compilation environment
@ 2025-07-23 12:57 Ashok Kaladi
  2025-07-23 14:24 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Ashok Kaladi @ 2025-07-23 12:57 UTC (permalink / raw)
  To: stephen; +Cc: dev

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: stephen@networkplumber.org

Signed-off-by: Ashok Kaladi <ashok.k.kaladi@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'
 
 clang_flags = [
         # these are flags used to build the BPF code
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/tap: fix BPF build failure in cross-compilation environment
  2025-07-23 12:57 [PATCH] net/tap: fix BPF build failure in cross-compilation environment Ashok Kaladi
@ 2025-07-23 14:24 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2025-07-23 14:24 UTC (permalink / raw)
  To: Ashok Kaladi; +Cc: dev

On Wed, 23 Jul 2025 07:57:02 -0500
Ashok Kaladi <ashok.k.kaladi@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: stephen@networkplumber.org
> 
> Signed-off-by: Ashok Kaladi <ashok.k.kaladi@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-23 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-23 12:57 [PATCH] net/tap: fix BPF build failure in cross-compilation environment Ashok Kaladi
2025-07-23 14:24 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).