openwrt/package/network/utils/xdp-tools/patches/023-libxdp-fix-compilation-on-multiarch-systems.patch
Christian Marangi 5acc4f919c
xdp-tools: fix compilation wrongly using host header
Currently it's needed to have gcc-multilib on the host to correctly
compile xdp-tools. This is wrong and means that we are using host header
to compile a tool.

By some searching in how the makefile works it was discovered that
BPF_CFLAGS were not used and required to be appended to config.mk

Only one single header was added but we should include each BPF_CFLAGS
from bpf.mk. To make this some patching to bpf-header were required and
some patches to xdp-tools were required.
Also it's needed to pass the correct target to BPF_CFLAGS.

With the following changes xdp-tools can correctly compile with each
header from bpf-headers and should not use any host header.

Co-Developed-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Andre Heider <a.heider@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/11825
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-05-01 19:11:34 +02:00

31 lines
954 B
Diff

From cb1ef3322671a67e2050a3eee18b49cdb4ed4bed Mon Sep 17 00:00:00 2001
From: Andre Heider <a.heider@gmail.com>
Date: Wed, 18 Jan 2023 20:54:41 +0100
Subject: [PATCH] libxdp: fix compilation on multiarch systems
Multiarch systems require an additional include path, which is covered
by ARCH_INCLUDES here. Just as lib/util, add it to BPF_CFLAGS.
Fixes compilation on debian:
In file included from xdp-dispatcher.c:3:
In file included from ../../headers/linux/bpf.h:11:
/usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found
Signed-off-by: Andre Heider <a.heider@gmail.com>
---
lib/libxdp/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/lib/libxdp/Makefile
+++ b/lib/libxdp/Makefile
@@ -30,7 +30,7 @@ PC_FILE := $(OBJDIR)/libxdp.pc
TEMPLATED_SOURCES := xdp-dispatcher.c
CFLAGS += -I$(HEADER_DIR)
-BPF_CFLAGS += -I$(HEADER_DIR)
+BPF_CFLAGS += -I$(HEADER_DIR) $(ARCH_INCLUDES)
ifndef BUILD_STATIC_ONLY