aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-08-10 01:34:43 -0700
committerKhem Raj <raj.khem@gmail.com>2022-08-10 08:48:30 -0700
commitbc2b1482a0a79a6ff7a9211d9a06f3d637ab9e3d (patch)
tree8a5ec47b1bb213fe019cb6450441480953b59664
parentad978133a1a10d609bb2545882a2f720a2572f3d (diff)
downloadmeta-openembedded-bc2b1482a0a79a6ff7a9211d9a06f3d637ab9e3d.tar.gz
fluentbit: Fix build with musl
Pass large enough default for FLB_CORO_STACK_SIZE Remove unused jemalloc patch Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/recipes-extended/fluentbit/fluentbit/0001-Use-posix-strerror_r-with-musl.patch34
-rw-r--r--meta-oe/recipes-extended/fluentbit/fluentbit/0002-chunkio-Link-with-fts-library-with-musl.patch28
-rw-r--r--meta-oe/recipes-extended/fluentbit/fluentbit/jemalloc.patch16
-rw-r--r--meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb9
4 files changed, 69 insertions, 18 deletions
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/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..4ffb20d9ca
--- /dev/null
+++ b/meta-oe/recipes-extended/fluentbit/fluentbit/0002-chunkio-Link-with-fts-library-with-musl.patch
@@ -0,0 +1,28 @@
+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>
+---
+ 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/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}/
diff --git a/meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb b/meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb
index 2b1c4ca19c..ea6f81cbf0 100644
--- a/meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb
+++ b/meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb
@@ -23,6 +23,10 @@ SRC_URI = "https://releases.fluentbit.io/1.9/source-${PV}.tar.gz;subdir=fluent-b
file://0005-stackdriver-Fix-return-type-mismatch.patch \
file://0006-monkey-Fix-TLS-detection-testcase.patch \
"
+SRC_URI:append:libc-musl = "\
+ file://0001-Use-posix-strerror_r-with-musl.patch \
+ file://0002-chunkio-Link-with-fts-library-with-musl.patch \
+ "
SRC_URI[sha256sum] = "5ef7dd97e10936269fe5f4e5d3ebf16559333066f7d6757ba12464a9d6186570"
S = "${WORKDIR}/fluent-bit-${PV}"
@@ -43,8 +47,6 @@ do_compile:append() {
find ${B} -name '*.c' -or -name '*.h' | xargs sed -i -e 's|${TMPDIR}|/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/|g'
}
-FLB_JEMALLOC_OPTIONS_LIST = "--with-jemalloc-prefix=je_ --with-lg-quantum=3"
-
PACKAGECONFIG ?= "yaml"
LTO = ""
@@ -70,6 +72,9 @@ EXTRA_OECMAKE += "${@bb.utils.contains('DISTRO_FEATURES','systemd','-DFLB_SYSTEM
# Enable release builds
EXTRA_OECMAKE += "-DFLB_RELEASE=On"
+# musl needs these options
+EXTRA_OECMAKE:append:libc-musl = ' -DFLB_JEMALLOC_OPTIONS="--with-jemalloc-prefix=je_ --with-lg-quantum=3" -DFLB_CORO_STACK_SIZE=24576'
+
EXTRA_OECMAKE:append:riscv64 = " -DFLB_DEPS='atomic'"
EXTRA_OECMAKE:append:riscv32 = " -DFLB_DEPS='atomic'"