diff options
Diffstat (limited to 'meta-oe/recipes-extended/fluentbit/fluentbit')
17 files changed, 519 insertions, 119 deletions
diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-CMakeLists.txt-Do-not-use-private-makefile-target.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-CMakeLists.txt-Do-not-use-private-makefile-target.patch new file mode 100644 index 0000000000..f5a1716c07 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-CMakeLists.txt-Do-not-use-private-makefile-target.patch @@ -0,0 +1,70 @@ +From 6a704ab7bf69cd5d6970b3a7d3ae7798b26027c1 Mon Sep 17 00:00:00 2001 +From: Paulo Neves <ptsneves@gmail.com> +Date: Thu, 28 Jul 2022 11:28:41 +0200 +Subject: [PATCH] CMakeLists.txt Do not use private makefile $< target + +$< is a private detail from the Makefile generated by CMakefile and +are not under control or to be used at the CMakeLists level. In 3.20 +that private generation changed pre-requisite targets[1] and now logs +contain the path compiler_depend.ts instead of the actual file. + +Upstream-Status: Pending [https://github.com/fluent/fluent-bit/issues/5492] +--- + CMakeLists.txt | 6 +----- + lib/chunkio/CMakeLists.txt | 7 +------ + lib/cmetrics/CMakeLists.txt | 7 +------ + 3 files changed, 3 insertions(+), 17 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3dba5a8..d94b988 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,11 +46,7 @@ else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + endif() + +-if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") +-else() +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") +-endif() ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") + + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l") + set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -latomic") +diff --git a/lib/chunkio/CMakeLists.txt b/lib/chunkio/CMakeLists.txt +index bbe1f39..809ea93 100644 +--- a/lib/chunkio/CMakeLists.txt ++++ b/lib/chunkio/CMakeLists.txt +@@ -14,12 +14,7 @@ else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall ") + endif() + +-# Set __FILENAME__ +-if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") +-else() +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") +-endif() ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") + + include(cmake/macros.cmake) + +diff --git a/lib/cmetrics/CMakeLists.txt b/lib/cmetrics/CMakeLists.txt +index 60e8774..e3d6149 100644 +--- a/lib/cmetrics/CMakeLists.txt ++++ b/lib/cmetrics/CMakeLists.txt +@@ -34,12 +34,7 @@ set(CMT_VERSION_MINOR 3) + set(CMT_VERSION_PATCH 5) + set(CMT_VERSION_STR "${CMT_VERSION_MAJOR}.${CMT_VERSION_MINOR}.${CMT_VERSION_PATCH}") + +-# Define __FILENAME__ consistently across Operating Systems +-if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") +-else() +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") +-endif() ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") + + # Configuration options + option(CMT_DEV "Enable development mode" No) diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-Use-posix-strerror_r-with-musl.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-Use-posix-strerror_r-with-musl.patch new file mode 100644 index 0000000000..8d89e4df35 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-Use-posix-strerror_r-with-musl.patch @@ -0,0 +1,34 @@ +From f645128082117a0152a95b3dccd869a184b7513f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 10 Aug 2022 01:23:48 -0700 +Subject: [PATCH 1/2] Use posix strerror_r with musl + +Default with glibc is GNU extention of strerror_r +where as musl uses posix variant, call that out + +Upstream-Status: Inappropriate [Need wider porting beyond linux/musl/glibc] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/flb_network.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/flb_network.c b/src/flb_network.c +index 992eb1d..5d7a337 100644 +--- a/src/flb_network.c ++++ b/src/flb_network.c +@@ -506,7 +506,12 @@ static int net_connect_async(int fd, + } + + /* Connection is broken, not much to do here */ ++#ifdef __GLIBC__ + str = strerror_r(error, so_error_buf, sizeof(so_error_buf)); ++#else ++ strerror_r(error, so_error_buf, sizeof(so_error_buf)); ++ str = so_error_buf; ++#endif + flb_error("[net] TCP connection failed: %s:%i (%s)", + u->tcp_host, u->tcp_port, str); + return -1; +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-monkey-Define-_GNU_SOURCE-for-memmem-API-check.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-monkey-Define-_GNU_SOURCE-for-memmem-API-check.patch new file mode 100644 index 0000000000..e70664031b --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-monkey-Define-_GNU_SOURCE-for-memmem-API-check.patch @@ -0,0 +1,28 @@ +From 0d22024c5defba7007e3e633753790e20209c6f6 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 9 Aug 2022 09:59:41 -0700 +Subject: [PATCH 1/5] monkey: Define _GNU_SOURCE for memmem API check + +This define is necessary to get this API on glibc based systems + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + lib/monkey/mk_core/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/monkey/mk_core/CMakeLists.txt b/lib/monkey/mk_core/CMakeLists.txt +index 0e74f8d..739fff3 100644 +--- a/lib/monkey/mk_core/CMakeLists.txt ++++ b/lib/monkey/mk_core/CMakeLists.txt +@@ -62,6 +62,7 @@ set(src "${src}" + ) + + check_c_source_compiles(" ++ #define _GNU_SOURCE + #include <string.h> + int main() { + char haystack[] = \"1234\"; +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-ppc-Fix-signature-for-co_create-API.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0001-ppc-Fix-signature-for-co_create-API.patch deleted file mode 100644 index 1f36c657ed..0000000000 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/0001-ppc-Fix-signature-for-co_create-API.patch +++ /dev/null @@ -1,38 +0,0 @@ -From be4032079c931704f52e29f5da5c01cde24ac842 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Thu, 16 Jan 2020 10:44:58 -0800 -Subject: [PATCH] ppc: Fix signature for co_create API - -Upstream-Status: Submitted [https://github.com/fluent/fluent-bit/pull/1886] -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - lib/flb_libco/ppc.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/lib/flb_libco/ppc.c b/lib/flb_libco/ppc.c -index e6536d56..533256b3 100644 ---- a/lib/flb_libco/ppc.c -+++ b/lib/flb_libco/ppc.c -@@ -279,7 +279,9 @@ static uint32_t* co_create_(unsigned size, uintptr_t entry) { - return t; - } - --cothread_t co_create(unsigned int size, void (*entry_)(void)) { -+cothread_t co_create(unsigned int size, void (*entry_)(void), -+ size_t *out_size) { -+ - uintptr_t entry = (uintptr_t)entry_; - uint32_t* t = 0; - -@@ -325,7 +327,7 @@ cothread_t co_create(unsigned int size, void (*entry_)(void)) { - t[10] = (uint32_t)(sp >> shift >> shift); - t[11] = (uint32_t)sp; - } -- -+ *out_size = size; - return t; - } - --- -2.25.0 - diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-chunkio-Link-with-fts-library-with-musl.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-chunkio-Link-with-fts-library-with-musl.patch new file mode 100644 index 0000000000..bdcc534964 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-chunkio-Link-with-fts-library-with-musl.patch @@ -0,0 +1,30 @@ +From 63dbbad5978e5f5b0e7d42614999cb6b4ebcce10 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 10 Aug 2022 01:27:16 -0700 +Subject: [PATCH 2/2] chunkio: Link with fts library with musl + +Fixes +cio_utils.c:(.text+0x64): undefined reference to `fts_read' + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + lib/chunkio/src/CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/chunkio/src/CMakeLists.txt b/lib/chunkio/src/CMakeLists.txt +index a4fc2d3..4244eb8 100644 +--- a/lib/chunkio/src/CMakeLists.txt ++++ b/lib/chunkio/src/CMakeLists.txt +@@ -13,6 +13,7 @@ set(src + ) + + set(libs cio-crc32) ++set(libs ${libs} fts) + + if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(src +-- +2.37.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 new file mode 100644 index 0000000000..425b838b78 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-flb_info.h.in-Do-not-hardcode-compilation-directorie.patch @@ -0,0 +1,28 @@ +From 71dab751a27a2e582b711de22873065dd28f4b65 Mon Sep 17 00:00:00 2001 +From: Paulo Neves <ptsneves@gmail.com> +Date: Thu, 28 Jul 2022 11:42:31 +0200 +Subject: [PATCH] flb_info.h.in: Do not hardcode compilation directories + +Including the source dir in the header makes the header not +reproducible and contaminates it with host builder paths. Instead +make it take CMAKE_DEBUG_SRCDIR that can be set to a known +reproducible value +--- +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 a89485c..2579afc 100644 +--- a/include/fluent-bit/flb_info.h.in ++++ b/include/fluent-bit/flb_info.h.in +@@ -23,7 +23,7 @@ + #define STR_HELPER(s) #s + #define STR(s) STR_HELPER(s) + +-#define FLB_SOURCE_DIR "@CMAKE_SOURCE_DIR@" ++#define FLB_SOURCE_DIR "@CMAKE_DEBUG_SRCDIR@" + + /* General flags set by CMakeLists.txt */ + @FLB_BUILD_FLAGS@ diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0002-mbedtls-Remove-unused-variable.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-mbedtls-Remove-unused-variable.patch new file mode 100644 index 0000000000..d911420df2 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-mbedtls-Remove-unused-variable.patch @@ -0,0 +1,40 @@ +From c7b969d1a2a6b61bd179214ee2516b7b6cd55b27 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 9 Aug 2022 11:21:57 -0700 +Subject: [PATCH 2/5] mbedtls: Remove unused variable + +Fixes +library/bignum.c:1395:29: error: variable 't' set but not used [-Werror,-Wunused-but-set-variable] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + lib/mbedtls-2.28.0/library/bignum.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/lib/mbedtls-2.28.0/library/bignum.c b/lib/mbedtls-2.28.0/library/bignum.c +index 62e7f76..9c256ae 100644 +--- a/lib/mbedtls-2.28.0/library/bignum.c ++++ b/lib/mbedtls-2.28.0/library/bignum.c +@@ -1392,7 +1392,7 @@ void mpi_mul_hlp( size_t i, + mbedtls_mpi_uint *d, + mbedtls_mpi_uint b ) + { +- mbedtls_mpi_uint c = 0, t = 0; ++ mbedtls_mpi_uint c = 0; + + #if defined(MULADDC_HUIT) + for( ; i >= 8; i -= 8 ) +@@ -1443,8 +1443,6 @@ void mpi_mul_hlp( size_t i, + } + #endif /* MULADDC_HUIT */ + +- t++; +- + while( c != 0 ) + { + *d += c; c = ( *d < c ); d++; +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0003-mbedtls-Disable-documentation-warning-as-error-with-.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-mbedtls-Disable-documentation-warning-as-error-with-.patch new file mode 100644 index 0000000000..473ebaf7d4 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-mbedtls-Disable-documentation-warning-as-error-with-.patch @@ -0,0 +1,32 @@ +From 2d12629f768d2459b1fc8a8ca0c38024d84bc195 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 9 Aug 2022 11:32:12 -0700 +Subject: [PATCH 3/5] mbedtls: Disable documentation warning as error with + clang + +There are shortcomings with doxygen info which clang-15+ flags, dont +treat them as errors + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + lib/mbedtls-2.28.0/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/mbedtls-2.28.0/CMakeLists.txt b/lib/mbedtls-2.28.0/CMakeLists.txt +index b33c088..c5f886f 100644 +--- a/lib/mbedtls-2.28.0/CMakeLists.txt ++++ b/lib/mbedtls-2.28.0/CMakeLists.txt +@@ -212,7 +212,7 @@ if(CMAKE_COMPILER_IS_GNU) + endif(CMAKE_COMPILER_IS_GNU) + + if(CMAKE_COMPILER_IS_CLANG) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral -Wno-error=documentation") + set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") + set(CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3") + set(CMAKE_C_FLAGS_ASANDBG "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls") +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0003-mbedtls-Do-not-overwrite-CFLAGS.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-mbedtls-Do-not-overwrite-CFLAGS.patch new file mode 100644 index 0000000000..158857ae20 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0003-mbedtls-Do-not-overwrite-CFLAGS.patch @@ -0,0 +1,34 @@ +From 8486b912281ae85db0c9fc05bb546f16872e114c Mon Sep 17 00:00:00 2001 +From: Paulo Neves <ptsneves@gmail.com> +Date: Thu, 28 Jul 2022 14:37:18 +0200 +Subject: [PATCH] mbedtls: Do not overwrite CFLAGS + +bitbake passes CFLAGS that are often in conflict with the ones set +in mbedtls' CMakeLists.txt. Such conflicts are the inability to use +FORTIFY_SOURCE=2 except in release mode + +Upstream-Status: Inappropriate [due to fluent-bit having it's own Release flags that also overwrite bitbake ones.] +--- + lib/mbedtls-2.28.0/CMakeLists.txt | 2 -- + 1 file changed, 2 deletions(-) + +--- a/lib/mbedtls-2.28.0/CMakeLists.txt ++++ b/lib/mbedtls-2.28.0/CMakeLists.txt +@@ -204,8 +204,6 @@ if(CMAKE_COMPILER_IS_GNU) + if (GCC_VERSION VERSION_GREATER 7.0 OR GCC_VERSION VERSION_EQUAL 7.0) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-overflow=2 -Wformat-truncation") + endif() +- set(CMAKE_C_FLAGS_RELEASE "-O2") +- set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") + set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") + set(CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3") + set(CMAKE_C_FLAGS_ASANDBG "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls") +@@ -215,8 +213,6 @@ endif(CMAKE_COMPILER_IS_GNU) + + if(CMAKE_COMPILER_IS_CLANG) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat=2 -Wno-format-nonliteral") +- set(CMAKE_C_FLAGS_RELEASE "-O2") +- set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") + set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage") + set(CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3") + set(CMAKE_C_FLAGS_ASANDBG "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls") diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0004-Use-correct-type-to-store-return-from-flb_kv_item_cr.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0004-Use-correct-type-to-store-return-from-flb_kv_item_cr.patch new file mode 100644 index 0000000000..bd4276193d --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0004-Use-correct-type-to-store-return-from-flb_kv_item_cr.patch @@ -0,0 +1,45 @@ +From a797b79483940ed4adcaa5fe2c40dd0487c7c2c7 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 9 Aug 2022 11:39:08 -0700 +Subject: [PATCH 4/5] Use correct type to store return from flb_kv_item_create + +Fix +error: incompatible pointer to integer conversion assigning to 'int' from 'struct flb_kv *' + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + plugins/out_stackdriver/stackdriver_conf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/plugins/out_stackdriver/stackdriver_conf.c b/plugins/out_stackdriver/stackdriver_conf.c +index a9a8eb0..e4f969e 100644 +--- a/plugins/out_stackdriver/stackdriver_conf.c ++++ b/plugins/out_stackdriver/stackdriver_conf.c +@@ -176,12 +176,12 @@ static int read_credentials_file(const char *cred_file, struct flb_stackdriver * + + static int parse_configuration_labels(struct flb_stackdriver *ctx) + { +- int ret; + char *p; + flb_sds_t key; + flb_sds_t val; + struct mk_list *head; + struct flb_slist_entry *entry; ++ struct flb_kv *ret; + msgpack_object_kv *kv = NULL; + + if (ctx->labels) { +@@ -216,7 +216,7 @@ static int parse_configuration_labels(struct flb_stackdriver *ctx) + flb_sds_destroy(key); + flb_sds_destroy(val); + +- if (ret == -1) { ++ if (!ret) { + return -1; + } + } +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0004-build-Make-systemd-init-systemd-detection-contingent.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0004-build-Make-systemd-init-systemd-detection-contingent.patch new file mode 100644 index 0000000000..f6e3dce2f3 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0004-build-Make-systemd-init-systemd-detection-contingent.patch @@ -0,0 +1,63 @@ +From 7a792624925d46690c1f07fe4b194b5f4c510db6 Mon Sep 17 00:00:00 2001 +From: Paulo Neves <ptsneves@gmail.com> +Date: Tue, 2 Aug 2022 09:57:05 +0200 +Subject: [PATCH 1/1] build: Make systemd init systemd detection contingent on + pkgconfig + +Use pkg-config to get systemd.pc variables and systemdunitdir. Those +variable ensure that .service files are installed in the correct paths +and only when systemd is detected. + +Upstream-Status: Pending [https://github.com/fluent/fluent-bit/pull/5818] + +--- + cmake/FindJournald.cmake | 4 ++++ + src/CMakeLists.txt | 4 ++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/cmake/FindJournald.cmake b/cmake/FindJournald.cmake +index f5a3a832b..9e6657a29 100644 +--- a/cmake/FindJournald.cmake ++++ b/cmake/FindJournald.cmake +@@ -5,6 +5,8 @@ + # JOURNALD_INCLUDE_DIR - the Journald include directory + # JOURNALD_LIBRARIES - Link these to use Journald + # JOURNALD_DEFINITIONS - Compiler switches required for using Journald ++# SYSTEMD_UNITDIR - The systemd units' directory ++# + # Redistribution and use is allowed according to the terms of the BSD license. + # For details see the accompanying COPYING-CMAKE-SCRIPTS file. + # +@@ -16,7 +18,9 @@ + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_JOURNALD QUIET systemd) ++pkg_get_variable(PC_SYSTEMD_UNITDIR systemd "systemdsystemunitdir") + ++set(SYSTEMD_UNITDIR ${PC_SYSTEMD_UNITDIR}) + set(JOURNALD_FOUND ${PC_JOURNALD_FOUND}) + set(JOURNALD_DEFINITIONS ${PC_JOURNALD_CFLAGS_OTHER}) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 522bbf9bd..30743d8d6 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -480,13 +480,13 @@ if(FLB_BINARY) + endif() + + # Detect init system, install upstart, systemd or init.d script +- if(IS_DIRECTORY /lib/systemd/system) ++ if(DEFINED SYSTEMD_UNITDIR) + set(FLB_SYSTEMD_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.service") + configure_file( + "${PROJECT_SOURCE_DIR}/init/systemd.in" + ${FLB_SYSTEMD_SCRIPT} + ) +- install(FILES ${FLB_SYSTEMD_SCRIPT} COMPONENT binary DESTINATION /lib/systemd/system) ++ install(FILES ${FLB_SYSTEMD_SCRIPT} COMPONENT binary DESTINATION ${SYSTEMD_UNITDIR}) + install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR} COMPONENT binary) + elseif(IS_DIRECTORY /usr/share/upstart) + set(FLB_UPSTART_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.conf") +-- +2.25.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0005-stackdriver-Fix-return-type-mismatch.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0005-stackdriver-Fix-return-type-mismatch.patch new file mode 100644 index 0000000000..f023ab5732 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0005-stackdriver-Fix-return-type-mismatch.patch @@ -0,0 +1,33 @@ +From 27f0bd5a3339612e03112e6b490900a9fabc3337 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 9 Aug 2022 11:44:25 -0700 +Subject: [PATCH 5/5] stackdriver: Fix return type mismatch + +Fix +error: incompatible integer to pointer conversion returning 'int' from a function with result type 'flb_sds_t' (aka 'char *') [-Wint-conversion] + return -1; + ^~ + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + plugins/out_stackdriver/stackdriver.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plugins/out_stackdriver/stackdriver.c b/plugins/out_stackdriver/stackdriver.c +index ae66bf2..e01755c 100644 +--- a/plugins/out_stackdriver/stackdriver.c ++++ b/plugins/out_stackdriver/stackdriver.c +@@ -2033,7 +2033,7 @@ static flb_sds_t stackdriver_format(struct flb_stackdriver *ctx, + flb_sds_destroy(operation_producer); + msgpack_unpacked_destroy(&result); + msgpack_sbuffer_destroy(&mp_sbuf); +- return -1; ++ return NULL; + } + + /* Number of parsed labels */ +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0006-monkey-Fix-TLS-detection-testcase.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0006-monkey-Fix-TLS-detection-testcase.patch new file mode 100644 index 0000000000..c3f2574d26 --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0006-monkey-Fix-TLS-detection-testcase.patch @@ -0,0 +1,36 @@ +From f88d9b82e8bd8ae38fba666b5825ffb41769f81a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 9 Aug 2022 12:25:22 -0700 +Subject: [PATCH] monkey: Fix TLS detection testcase + +Clang15 errors out on compiling the check and disables TLS + +Fixes errors like + +error: call to undeclared function '__tls_get_addr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] + __tls_get_addr(0); + ^ + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + lib/monkey/CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/monkey/CMakeLists.txt b/lib/monkey/CMakeLists.txt +index 15e62e8..96ac2bd 100644 +--- a/lib/monkey/CMakeLists.txt ++++ b/lib/monkey/CMakeLists.txt +@@ -178,6 +178,8 @@ endif() + # Use old Pthread TLS + if(NOT MK_PTHREAD_TLS) + check_c_source_compiles(" ++ #include <sys/types.h> ++ extern void *__tls_get_addr(size_t *v); + __thread int a; + int main() { + __tls_get_addr(0); +-- +2.37.1 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/0007-cmake-Do-not-check-for-upstart-on-build-host.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/0007-cmake-Do-not-check-for-upstart-on-build-host.patch new file mode 100644 index 0000000000..71bdd34eeb --- /dev/null +++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0007-cmake-Do-not-check-for-upstart-on-build-host.patch @@ -0,0 +1,46 @@ +From c41653e856d05ed430d22f8b311714ff756a0e0b Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 23 Mar 2023 18:05:27 -0700 +Subject: [PATCH] cmake: Do not check for upstart on build host + +Some ubuntu distros might have this directory /usr/share/upstart around +and yocto based distros not using systemd will process this piece of +code and falsely assume that target supports upstart, which may not be +true in case of cross-compilation. + +This also can end up in configure errors e.g. + +| CMake Error at src/CMakeLists.txt:496 (install): +| install DIRECTORY given unknown argument "/etc/td-agent-bit/". +| +| +| -- Configuring incomplete, errors occurred! + +Upstream-Status: Inappropriate [ Cross-compile Specific ] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/CMakeLists.txt | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index bb30b2a..c63b6d8 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -486,14 +486,6 @@ if(FLB_BINARY) + ) + install(FILES ${FLB_SYSTEMD_SCRIPT} COMPONENT binary DESTINATION ${SYSTEMD_UNITDIR}) + install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR} COMPONENT binary) +- elseif(IS_DIRECTORY /usr/share/upstart) +- set(FLB_UPSTART_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.conf") +- configure_file( +- "${PROJECT_SOURCE_DIR}/init/upstart.in" +- ${FLB_UPSTART_SCRIPT} +- ) +- install(FILES ${FLB_UPSTART_SCRIPT} COMPONENT binary DESTINATION /etc/init) +- install(DIRECTORY DESTINATION COMPONENT binary ${FLB_INSTALL_CONFDIR}) + else() + # FIXME: should we support Sysv init script ? + endif() +-- +2.40.0 + diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/builtin-nan.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/builtin-nan.patch deleted file mode 100644 index 8ffc3be3ef..0000000000 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/builtin-nan.patch +++ /dev/null @@ -1,27 +0,0 @@ -help complier to use intrinsics, clang in few cases e.g. aarch64 can not -and then requires linking with libm, its the only function needed from libm then -its good to avoid needing it. - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- a/include/fluent-bit/stream_processor/flb_sp_timeseries.h -+++ b/include/fluent-bit/stream_processor/flb_sp_timeseries.h -@@ -207,7 +207,7 @@ void cb_forecast_calc(struct timeseries - result = b0 + b1 * (val->f64 + *forecast->latest_x); - break; - default: -- result = nan(""); -+ result = __builtin_nan(""); - break; - } - -@@ -283,7 +283,7 @@ void cb_forecast_r_calc(struct timeserie - result = ((val->i64 - b0) / b1) - *forecast->latest_x; - break; - default: -- result = nan(""); -+ result = __builtin_nan(""); - break; - } - diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/cross-build-init-system-detection.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/cross-build-init-system-detection.patch deleted file mode 100644 index a185789992..0000000000 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/cross-build-init-system-detection.patch +++ /dev/null @@ -1,38 +0,0 @@ -Define CMake variables to indicate init system for target -incase of cross compile, detecting systemd support based on -host directory structure is not right thing to do - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.kheem@gmail.com> - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -317,7 +317,7 @@ if(FLB_BINARY) - install(TARGETS fluent-bit-bin RUNTIME DESTINATION ${FLB_INSTALL_BINDIR}) - - # Detect init system, install upstart, systemd or init.d script -- if(IS_DIRECTORY /lib/systemd/system) -+ if(IS_DIRECTORY /lib/systemd/system OR FLB_SYSTEMD) - set(FLB_SYSTEMD_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.service") - configure_file( - "${PROJECT_SOURCE_DIR}/init/systemd.in" -@@ -325,7 +325,7 @@ if(FLB_BINARY) - ) - install(FILES ${FLB_SYSTEMD_SCRIPT} DESTINATION /lib/systemd/system) - install(DIRECTORY DESTINATION ${FLB_INSTALL_CONFDIR}) -- elseif(IS_DIRECTORY /usr/share/upstart) -+ elseif(IS_DIRECTORY /usr/share/upstart OR FLB_UPSTART) - set(FLB_UPSTART_SCRIPT "${PROJECT_SOURCE_DIR}/init/${FLB_OUT_NAME}.conf") - configure_file( - "${PROJECT_SOURCE_DIR}/init/upstart.in" ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -70,6 +70,8 @@ option(FLB_RECORD_ACCESSOR "Enable re - option(FLB_SYSTEM_STRPTIME "Use strptime in system libc" Yes) - option(FLB_STATIC_CONF "Build binary using static configuration") - option(FLB_STREAM_PROCESSOR "Enable Stream Processor" Yes) -+option(FLB_SYSTEMD "Enable systemd init system" No) -+option(FLB_UPSTART "Enable upstart init system" No) - option(FLB_CORO_STACK_SIZE "Set coroutine stack size") - - # Metrics: Experimental Feature, disabled by default on 0.12 series diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit/jemalloc.patch b/meta-oe/recipes-extended/fluentbit/fluentbit/jemalloc.patch deleted file mode 100644 index 67b3397a6f..0000000000 --- a/meta-oe/recipes-extended/fluentbit/fluentbit/jemalloc.patch +++ /dev/null @@ -1,16 +0,0 @@ -Add --with-jemalloc-prefix=je_ so it compiles on musl - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Upstream-Status: Pending - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -523,7 +523,7 @@ if(FLB_JEMALLOC AND ${CMAKE_SYSTEM_NAME} - # Link to Jemalloc as an external dependency - ExternalProject_Add(jemalloc - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1 -- CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1/configure ${AUTOCONF_HOST_OPT} --with-lg-quantum=3 --enable-cc-silence --prefix=<INSTALL_DIR> -+ CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/jemalloc-5.2.1/configure ${AUTOCONF_HOST_OPT} --with-jemalloc-prefix=je_ --with-lg-quantum=3 --enable-cc-silence --prefix=<INSTALL_DIR> - CFLAGS=-std=gnu99\ -Wall\ -pipe\ -g3\ -O3\ -funroll-loops - BUILD_COMMAND $(MAKE) - INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/ |