From 2464c020bb95df0511690302e4058f1d538c75fa Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 2 May 2025 17:05:28 -0700 Subject: [PATCH] fluent-bit: Upgrade to 4.0.1 release Refresh and forward port patches Add -std=gnu17 to fix build with GCC-15 Signed-off-by: Khem Raj --- ...rivate-makefile-targets-in-CMakelist.patch | 16 ++++--------- ...-not-hardcode-compilation-directorie.patch | 2 -- ...ts.txt-Revise-init-manager-deduction.patch | 18 +++++++-------- ...{fluentbit_3.2.8.bb => fluentbit_4.0.1.bb} | 23 +++++++++++-------- 4 files changed, 26 insertions(+), 33 deletions(-) rename meta-oe/recipes-extended/fluentbit/{fluentbit_3.2.8.bb => fluentbit_4.0.1.bb} (90%) diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch index fae98f1f5d..32f4fdec51 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-lib-Do-not-use-private-makefile-targets-in-CMakelist.patch @@ -28,8 +28,6 @@ Upstream-Status: Submitted [https://github.com/fluent/fluent-bit/pull/9450] lib/monkey/CMakeLists.txt | 4 +--- 4 files changed, 7 insertions(+), 21 deletions(-) -diff --git a/lib/cfl/CMakeLists.txt b/lib/cfl/CMakeLists.txt -index 2193cb29c..e2a5cba37 100644 --- a/lib/cfl/CMakeLists.txt +++ b/lib/cfl/CMakeLists.txt @@ -40,12 +40,8 @@ if(NOT MSVC) @@ -47,8 +45,6 @@ index 2193cb29c..e2a5cba37 100644 -diff --git a/lib/cmetrics/CMakeLists.txt b/lib/cmetrics/CMakeLists.txt -index 18582997d..8f7176dd6 100644 --- a/lib/cmetrics/CMakeLists.txt +++ b/lib/cmetrics/CMakeLists.txt @@ -60,12 +60,8 @@ if(NOT MSVC) @@ -66,12 +62,10 @@ index 18582997d..8f7176dd6 100644 # Configuration options option(CMT_DEV "Enable development mode" No) -diff --git a/lib/ctraces/CMakeLists.txt b/lib/ctraces/CMakeLists.txt -index e47ba022d..0ddfd5f97 100644 --- a/lib/ctraces/CMakeLists.txt +++ b/lib/ctraces/CMakeLists.txt @@ -30,12 +30,8 @@ set(CTR_VERSION_MINOR 6) - set(CTR_VERSION_PATCH 0) + set(CTR_VERSION_PATCH 4) set(CTR_VERSION_STR "${CTR_VERSION_MAJOR}.${CTR_VERSION_MINOR}.${CTR_VERSION_PATCH}") -# Define __FILENAME__ consistently across Operating Systems @@ -85,8 +79,6 @@ index e47ba022d..0ddfd5f97 100644 # Configuration options option(CTR_DEV "Enable development mode" No) -diff --git a/lib/monkey/CMakeLists.txt b/lib/monkey/CMakeLists.txt -index 028240bcc..b386cb726 100644 --- a/lib/monkey/CMakeLists.txt +++ b/lib/monkey/CMakeLists.txt @@ -15,10 +15,8 @@ include(GNUInstallDirs) @@ -95,9 +87,9 @@ index 028240bcc..b386cb726 100644 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$$(subst ${CMAKE_SOURCE_DIR}/,,$$(abspath \$$<))\"'") -else() -+endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") --endif() +-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") + endif() ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") # Monkey Version set(MK_VERSION_MAJOR 1) diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch index 01a11e3be7..025f8729ea 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch @@ -13,8 +13,6 @@ Upstream-Status: Pending include/fluent-bit/flb_info.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/include/fluent-bit/flb_info.h.in b/include/fluent-bit/flb_info.h.in -index 3a08f8051..aa6a48f29 100644 --- a/include/fluent-bit/flb_info.h.in +++ b/include/fluent-bit/flb_info.h.in @@ -23,7 +23,7 @@ diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch index 8dd4da47ec..909d1be28d 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-CMakeLists.txt-Revise-init-manager-deduction.patch @@ -14,23 +14,21 @@ Upstream-Status: Inappropriate [configuration] src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 8404b65c1..0c7876058 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -546,7 +546,7 @@ if(FLB_BINARY) +@@ -569,7 +569,7 @@ if(FLB_BINARY) set(SYSTEMD_UNITDIR /lib/systemd/system) endif() - if(SYSTEMD_UNITDIR) + if(@INIT_MANAGER_IS_SYSTEMD@) - set(FLB_SYSTEMD_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.service") - configure_file( - "${PROJECT_SOURCE_DIR}/init/systemd.in" -@@ -554,7 +554,7 @@ if(FLB_BINARY) - ) - install(FILES ${FLB_SYSTEMD_SCRIPT} COMPONENT binary DESTINATION ${SYSTEMD_UNITDIR}) - install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR} COMPONENT binary) + if (FLB_AMAZON_LINUX2) + set(FLB_SYSTEMD_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.service") + configure_file( +@@ -594,7 +594,7 @@ if(FLB_BINARY) + install(FILES ${FLB_SYSTEMD_SCRIPT} COMPONENT binary DESTINATION ${SYSTEMD_UNITDIR}) + install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR} COMPONENT binary) + endif() - elseif(IS_DIRECTORY /usr/share/upstart) + elseif(@INIT_MANAGER_IS_UPSTART@) set(FLB_UPSTART_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.conf") diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_3.2.8.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb similarity index 90% rename from meta-oe/recipes-extended/fluentbit/fluentbit_3.2.8.bb rename to meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb index 59e23567b1..4d82abc783 100644 --- a/meta-oe/recipes-extended/fluentbit/fluentbit_3.2.8.bb +++ b/meta-oe/recipes-extended/fluentbit/fluentbit_4.0.1.bb @@ -17,9 +17,9 @@ DEPENDS = "\ " DEPENDS:append:libc-musl = " fts" -SRCREV = "d13e8e4ab2029fa92600b7d1d0da28f8dcc350eb" +SRCREV = "b12e507090273576d1156342780c7c6d358fa579" SRC_URI = "\ - git://github.com/fluent/fluent-bit.git;branch=3.2;protocol=https \ + git://github.com/fluent/fluent-bit.git;branch=master;protocol=https \ 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 \ @@ -109,8 +109,8 @@ PACKAGECONFIG[windows-defaults] = "-DFLB_WINDOWS_DEFAULTS=Yes,-DFLB_WINDOWS_DEFA # individual plugins then to enable (e.g. using EXTRA_OECMAKE:append = " -DFLB_FOOBAR=ON") PACKAGECONFIG[minimal] = "-DFLB_MINIMAL=Yes,-DFLB_MINIMAL=No" -PACKAGECONFIG[in-kafka] = "-DFLB_IN_KAFKA=ON,-DFLB_IN_KAFKA=OFF,librdkafka curl" -PACKAGECONFIG[out-kafka] = "-DFLB_OUT_KAFKA=ON,-DFLB_OUT_KAFKA=OFF,librdkafka curl" +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" SYSTEMD_SERVICE:${PN} = "fluent-bit.service" @@ -124,13 +124,18 @@ FULL_OPTIMIZATION:remove = "${@'-O2' if bb.data.inherits_class('clang', d) else TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" TARGET_CC_ARCH:remove = "-D_FORTIFY_SOURCE=2" EXTRA_OECMAKE += "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/" -EXTRA_OECMAKE:append:mips = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic" -EXTRA_OECMAKE:append:powerpc = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic" -EXTRA_OECMAKE:append:riscv32 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic" -EXTRA_OECMAKE:append:riscv64 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic" -EXTRA_OECMAKE:append:x86 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic" + SECURITY_STRINGFORMAT:remove = "${@bb.utils.contains('PACKAGECONFIG', 'aws-error-reporter', '-Werror=format-security', '', d)}" +# GCC-15 uses C23 std and it does not yet compile with C23 +CFLAGS += "-std=gnu17" +# 64bit atomics builtins do not exist in compiler on these arches +LDFLAGS:append:mips = " -latomic" +LDFLAGS:append:powerpc = " -latomic" +LDFLAGS:append:riscv32 = " -latomic" +LDFLAGS:append:riscv64 = " -latomic" +LDFLAGS:append:x86 = " -latomic" + do_configure:prepend() { sed -i \ -e 's#@INIT_MANAGER_IS_SYSTEMD@#'${@'TRUE' if d.getVar('INIT_MANAGER') == 'systemd' else 'FALSE'}'#' \