Skip to contentSkip to conversation

fluentbit: add support for in-ebpf plugin

PATCH In review Timotheus Giuliani 2 participants 2 messages Nov 4, 2025 – Nov 5, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fluentbit: add support for in-ebpf plugin

Introduce support for the in-ebpf plugin in the Fluent Bit recipe, which was added as an experimental feature in Fluent Bit version 4.0. The new PACKAGECONFIG option enables building the eBPF input plugin when explicitly configured, adding the necessary build dependencies including bpftool-native, clang-native, and libbpf.
The recipe also configures the LIBC_PATH for compilation environments to ensure to point to the correct target system's C library when the eBPF plugin is enabled.

---
 ...root-include-path-for-system-headers.patch | 33 ++++++++
 ...coded-target-architecture-definition.patch | 56 ++++++++++++++
 ...tting-LIBC_PATH-from-external-config.patch | 75 +++++++++++++++++++
 .../fluentbit/fluentbit_4.0.1.bb              |  7 ++
 4 files changed, 171 insertions(+)
 create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0006-cmake-add-recipe-sysroot-include-path-for-system-headers.patch
 create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0007-bpf-remove-hardcoded-target-architecture-definition.patch
 create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0008-cmake-allow-setting-LIBC_PATH-from-external-config.patch
meta-oe/recipes-extended/fluentbit/fluentbit/0006-cmake-add-recipe-sysroot-include-path-for-system-headers.patch new file +33 -0
new file mode 100644
index 0000000000..e7b912bf33
@@ -0,0 +1,33 @@
+From 9f47cc69683a842efdf6c31ea25b7b423ba3fc7e Mon Sep 17 00:00:00 2001
+From: Timotheus Giuliani <[email protected]>
+Date: Tue, 7 Oct 2025 17:33:14 +0200
+Subject: [PATCH 1/3] cmake: add recipe sysroot include path for system headers
+
+The CMakeLists.txt was missing the recipe sysroot include path, which
+prevented the build system from finding required system headers during
+compilation. This commit adds the recipe sysroot directory to the
+include path so that headers provided by the sysroot, such as
+BPF headers and other system dependencies, can be properly located and
+included during the build process.
+Without this change, the build would fail to find essential headers
+when building in compilation environment.
+
+Upstream-Status: Inappropriate [Not suitable for upstream, OE-specific change]
+
+Signed-off-by: Timotheus Giuliani <[email protected]>
+---
+ plugins/in_ebpf/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/plugins/in_ebpf/CMakeLists.txt b/plugins/in_ebpf/CMakeLists.txt
+index 476c07774..216b2ffce 100644
+--- a/plugins/in_ebpf/CMakeLists.txt
++++ b/plugins/in_ebpf/CMakeLists.txt
+@@ -91,6 +91,7 @@ foreach(TRACE_C_FILE ${TRACE_C_FILES})
+             -I${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/includes/external
+             -I${CMAKE_SOURCE_DIR}/plugins/in_ebpf/traces/includes
+             -I${VMLINUX_PATH}         # Include the correct vmlinux.h based on architecture
++            --sysroot=${CMAKE_SYSROOT}  # Add yocto recipe sysroot to find "system headers"
+             -c ${TRACE_C_FILE}
+             -o ${TRACE_OBJ_FILE}
+     DEPENDS ${TRACE_C_FILE} ebpf-generated-directory
meta-oe/recipes-extended/fluentbit/fluentbit/0007-bpf-remove-hardcoded-target-architecture-definition.patch new file +56 -0

56 lines not on this page · raw message

meta-oe/recipes-extended/fluentbit/fluentbit/0008-cmake-allow-setting-LIBC_PATH-from-external-config.patch new file +75 -0

75 lines not on this page · raw message

meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb +7 -0
index 05e4fd937f..5f7fa7bb21 100644
@@ -23,6 +23,9 @@ SRC_URI = "\
     file://0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch \
     file://0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch \
     file://0003-CMakeLists.txt-Revise-init-manager-deduction.patch \
+    file://0006-cmake-add-recipe-sysroot-include-path-for-system-headers.patch \
+    file://0007-bpf-remove-hardcoded-target-architecture-definition.patch \
+    file://0008-cmake-allow-setting-LIBC_PATH-from-external-config.patch \
 "
 SRC_URI:append:libc-musl = "\
     file://0004-chunkio-Link-with-fts-library-with-musl.patch \
@@ -111,6 +114,10 @@ PACKAGECONFIG[minimal] = "-DFLB_MINIMAL=Yes,-DFLB_MINIMAL=No"
 PACKAGECONFIG[in-kafka] = "-DFLB_KAFKA=ON -DFLB_IN_KAFKA=ON,-DFLB_KAFKA=OFF -DFLB_IN_KAFKA=OFF,librdkafka curl"
 PACKAGECONFIG[out-kafka] = "-DFLB_KAFKA=ON -DFLB_OUT_KAFKA=ON,-DFLB_KAFKA=OFF -DFLB_OUT_KAFKA=OFF,librdkafka curl"
 
+# Add ebpf input
+PACKAGECONFIG[in-ebpf] = "-DFLB_IN_EBPF=Yes,-DFLB_IN_EBPF=No, bpftool-native clang-native libbpf"
+EXTRA_OECMAKE:append = " ${@bb.utils.contains('PACKAGECONFIG', 'in-ebpf', '-DLIBC_PATH=${libdir}/libc.so.6', '', d)}"
+
 SYSTEMD_SERVICE:${PN} = "fluent-bit.service"
 
 inherit cmake systemd pkgconfig
Signature · 1 line
2.43.0
#1 lore raw

On 11/4/25 15:55, Timotheus Giuliani via lists.openembedded.org wrote:
<snip>

meta-oe/recipes-extended/fluentbit/fluentbit/0007-bpf-remove-hardcoded-target-architecture-definition.patch line 13

Quoted 3 lines
meta-oe/recipes-extended/fluentbit/fluentbit/0007-bpf-remove-hardcoded-target-architecture-definition.patch new file +3 -0
+
+Upstream-Status: Inappropriate [Contribution not planned]
+

I think this warrants a bit of an explanation: why is it not planned to be contributed? Why is it better to maintain these patches going forward in this layer, instead of adding it them to upstream?