Skip to contentSkip to conversation

package/fluent-bit: bump to version 2.0.9

PATCH In review [email protected] 2 participants 8 messages Feb 11, 2023 – Feb 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 package/fluent-bit: bump to version 2.0.9

From: Thomas Devoogdt <[email protected]>

- Release Notes:

    https://fluentbit.io/announcements/v2.0.9/

- Patch dropped, as it is upstream:

    https://github.com/fluent/fluent-bit/commit/7bcb502ebdcd647d6b83c972805e734ad522eb1a

---
v2: moved to a serie of patches

 ...eLists.txt-only-require-a-C-compiler.patch | 27 -------------------
 package/fluent-bit/fluent-bit.hash            |  2 +-
 package/fluent-bit/fluent-bit.mk              |  2 +-
 3 files changed, 2 insertions(+), 29 deletions(-)
 delete mode 100644 package/fluent-bit/0001-CMakeLists.txt-only-require-a-C-compiler.patch
package/fluent-bit/0001-CMakeLists.txt-only-require-a-C-compiler.patch deleted +0 -27
deleted file mode 100644
index e71bcf0c0d..0000000000
@@ -1,27 +0,0 @@
-From 7bcb502ebdcd647d6b83c972805e734ad522eb1a Mon Sep 17 00:00:00 2001
-From: Thomas Devoogdt <[email protected]>
-Date: Mon, 30 Jan 2023 09:10:37 +0100
-Subject: [PATCH] CMakeLists.txt: only require a C compiler
-
-Fluent-bit is mostly written in C,
-so don't require CXX in the top-level project.
-
-Signed-off-by: Thomas Devoogdt <[email protected]>
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index a7adb02de..3ff7360d8 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -1,5 +1,5 @@
- cmake_minimum_required(VERSION 3.12)
--project(fluent-bit)
-+project(fluent-bit C)
- 
- # CMP0069 ensures that LTO is enabled for all compilers
- cmake_policy(SET CMP0069 NEW)
--- 
-2.30.2
-
package/fluent-bit/fluent-bit.hash +1 -1
index ce7cea7b59..0caadcd56f 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256  8ff5566389033669feabc9c69a5c6f417dad5c8b066454388e6a706507262acf  fluent-bit-2.0.8.tar.gz
+sha256  393ad4a6ced48c327607653d610ef273843085a17b6e5c8013877abdf31e6945  fluent-bit-2.0.9.tar.gz
 sha256  0d542e0c8804e39aa7f37eb00da5a762149dc682d7829451287e11b938e94594  LICENSE
package/fluent-bit/fluent-bit.mk +1 -1
index 13077e53cc..c10ef613d7 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-FLUENT_BIT_VERSION = 2.0.8
+FLUENT_BIT_VERSION = 2.0.9
 FLUENT_BIT_SITE = $(call github,fluent,fluent-bit,v$(FLUENT_BIT_VERSION))
 FLUENT_BIT_LICENSE = Apache-2.0
 FLUENT_BIT_LICENSE_FILES = LICENSE
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/3 package/fluent-bit: add support for non glibc toolchain

From: Thomas Devoogdt <[email protected]>

- require threads and dynamic library support
- require sync_4 support
- provide fts.h trough musl-fts

static_assert is not available if no C++ toolchain or no glibc is used, so add two patches to fix this

---
v2: rebased the c-ares patch

 .../0001-lib-cfl-fixup-static_assert.patch    | 33 +++++++++++
 .../0002-lib-c-ares-fixup-static_assert.patch | 56 +++++++++++++++++++
 package/fluent-bit/Config.in                  | 10 +++-
 package/fluent-bit/fluent-bit.mk              | 11 +++-
 4 files changed, 105 insertions(+), 5 deletions(-)
 create mode 100644 package/fluent-bit/0001-lib-cfl-fixup-static_assert.patch
 create mode 100644 package/fluent-bit/0002-lib-c-ares-fixup-static_assert.patch
package/fluent-bit/0001-lib-cfl-fixup-static_assert.patch new file +33 -0
new file mode 100644
index 0000000000..19dab7cac6
@@ -0,0 +1,33 @@
+From e4f825dd9e952f4a056bf89342049e67102ae6bb Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <[email protected]>
+Date: Wed, 1 Feb 2023 11:38:15 +0100
+Subject: [PATCH] lib: cfl: fixup static_assert
+
+"undefined reference to 'static_assert'"
+
+Not defined when using uClibc or if not C++ >= 11.
+
+upstream: https://github.com/Cyan4973/xxHash/commit/6189ecd3d44a693460f86280ccf49d33cb4b18e1
+
+Signed-off-by: Thomas Devoogdt <[email protected]>
+---
+ lib/cfl/lib/xxhash/xxhash.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/lib/cfl/lib/xxhash/xxhash.h b/lib/cfl/lib/xxhash/xxhash.h
+index 08ab79457..511c4d12b 100644
+--- a/lib/cfl/lib/xxhash/xxhash.h
++++ b/lib/cfl/lib/xxhash/xxhash.h
+@@ -1546,8 +1546,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size)
+ /* note: use after variable declarations */
+ #ifndef XXH_STATIC_ASSERT
+ #  if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)    /* C11 */
+-#    include <assert.h>
+-#    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
++#    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0)
+ #  elif defined(__cplusplus) && (__cplusplus >= 201103L)            /* C++11 */
+ #    define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0)
+ #  else
+-- 
+2.34.1
+
package/fluent-bit/0002-lib-c-ares-fixup-static_assert.patch new file +56 -0

56 lines not on this page · raw message

package/fluent-bit/Config.in +7 -3
index 6c2299e695..f53eacb447 100644
@@ -1,6 +1,9 @@
 config BR2_PACKAGE_FLUENT_BIT
 	bool "fluent-bit"
-	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on !BR2_STATIC_LIBS # dlfcn.h
+	select BR2_PACKAGE_MUSL_FTS if !BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_LIBYAML
 	help
@@ -29,5 +32,6 @@ config BR2_PACKAGE_FLUENT_BIT_WASM
 
 endif
 
-comment "fluent-bit needs a glibc toolchain"
-	depends on !BR2_TOOLCHAIN_USES_GLIBC
+comment "fluent-bit needs a toolchain w/ threads, dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
package/fluent-bit/fluent-bit.mk +9 -2
index c10ef613d7..4ecf813511 100644
@@ -49,12 +49,19 @@ FLUENT_BIT_CONF_OPTS += \
 	-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
 	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS"
 
+ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
+FLUENT_BIT_DEPENDENCIES += musl-fts
+FLUENT_BIT_LDFLAGS += -lfts
+endif
+
 # Uses __atomic_compare_exchange_8
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-FLUENT_BIT_CONF_OPTS += \
-	-DCMAKE_EXE_LINKER_FLAGS=-latomic
+FLUENT_BIT_LDFLAGS += -latomic
 endif
 
+FLUENT_BIT_CONF_OPTS += \
+	-DCMAKE_EXE_LINKER_FLAGS="$(FLUENT_BIT_LDFLAGS)"
+
 define FLUENT_BIT_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 0755 package/fluent-bit/S99fluent-bit \
 		$(TARGET_DIR)/etc/init.d/S99fluent-bit
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v2 2/3] package/fluent-bit: add support for non glibc toolchain

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"thomas" == thomas <[email protected]> writes:

From: Thomas Devoogdt <[email protected]>
- require threads and dynamic library support
- require sync_4 support
- provide fts.h trough musl-fts

static_assert is not available if no C++ toolchain or no glibc is used, so add two patches to fix this

Committed, thanks. We do have xxhash and c-ares packages in Buildroot, could you have a look at using those instead of these vendored libraries?

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 2/3] package/fluent-bit: add support for non glibc toolchain

Hi, Peter

It would indeed be better to link against those,
but this is sadly the nature of how fluent-bit is made.
Next to those two libs, there are a dozen of other libs that are also literally copied in their code base. What you are proposing is to adapt their cmakefile and only compile the static libs if no dynamic lib could be found. Or even never compile it and just pass the linker flags. I'm afraid that we could have compatibility problems by that, so I would keep it static for now.

Kr

Thomas Devoogdt

Op wo 15 feb. 2023 10:21 schreef Peter Korsgaard <[email protected]>:

Quoted 10 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"thomas" == thomas <[email protected]> writes:

From: Thomas Devoogdt <[email protected]>
- require threads and dynamic library support
- require sync_4 support
- provide fts.h trough musl-fts

static_assert is not available if no C++ toolchain or no glibc is used, so add two patches to fix this

Quoted 10 lines
Quoted 1 line

Committed, thanks. We do have xxhash and c-ares packages in Buildroot, could you have a look at using those instead of these vendored libraries?

--
Bye, Peter Korsgaard

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 2/3] package/fluent-bit: add support for non glibc toolchain

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Devoogdt <[email protected]> writes:

Hi, Peter
It would indeed be better to link against those, but this is sadly the nature of how fluent-bit is made.

Do you know why they have made that choice? From a quick look it doesn't seem like the code has been modified.

Quoted 6 lines

Next to those two libs, there are a dozen of other libs that are also literally copied in their code base. What you are proposing is to adapt their cmakefile and only compile the static libs if no dynamic lib could be found. Or even never compile it and just pass the linker flags. I'm afraid that we could have compatibility problems by that, so I would keep it static for now.

If that is the only option supported by upstream, then indeed that is what we will have to do. Will you monitor for security vulnerabilities in the vendored libraries and ensure this is also fixed there? E.G. we recently had a (low risk) vulnerability in c-ares.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH v2 3/3 package/fluent-bit: fix builds on s390x architectures

In reply to [email protected]

From: Thomas Devoogdt <[email protected]>

Fixes:
- http://autobuild.buildroot.net/results/856fd250f75a696694c70e3208ffcef7470a7082
- http://autobuild.buildroot.net/results/dceb413fb5d459338417d8dd5a42d95aa23e849b

---
v2: new patch in this serie

 package/fluent-bit/fluent-bit.mk | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
package/fluent-bit/fluent-bit.mk +14 -5
index 4ecf813511..d618fdf1e2 100644
@@ -12,6 +12,9 @@ FLUENT_BIT_CPE_ID_VENDOR = treasuredata
 FLUENT_BIT_CPE_ID_PRODUCT = fluent_bit
 FLUENT_BIT_DEPENDENCIES = host-bison host-flex libyaml openssl
 
+FLUENT_BIT_CFLAGS = $(TARGET_CFLAGS)
+FLUENT_BIT_CXXFLAGS = $(TARGET_CXXFLAGS)
+
 FLUENT_BIT_CONF_OPTS += \
 	-DFLB_DEBUG=No \
 	-DFLB_RELEASE=Yes \
@@ -42,12 +45,16 @@ FLUENT_BIT_CONF_OPTS += \
 FLUENT_BIT_CONF_OPTS += \
 	-DCMAKE_INSTALL_SYSCONFDIR="/etc/"
 
+# Fix multiple definition of `mk_tls_*'.
+# https://github.com/fluent/fluent-bit/issues/5537
+FLUENT_BIT_CFLAGS += -fcommon
+FLUENT_BIT_CXXFLAGS += -fcommon
+
 # Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h
 # large file support.
-# See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information.
-FLUENT_BIT_CONF_OPTS += \
-	-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
-	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS"
+# https://bugzilla.redhat.com/show_bug.cgi?id=574992
+FLUENT_BIT_CFLAGS += -U_FILE_OFFSET_BITS
+FLUENT_BIT_CXXFLAGS += -U_FILE_OFFSET_BITS
 
 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
 FLUENT_BIT_DEPENDENCIES += musl-fts
@@ -60,7 +67,9 @@ FLUENT_BIT_LDFLAGS += -latomic
 endif
 
 FLUENT_BIT_CONF_OPTS += \
-	-DCMAKE_EXE_LINKER_FLAGS="$(FLUENT_BIT_LDFLAGS)"
+	-DCMAKE_EXE_LINKER_FLAGS="$(FLUENT_BIT_LDFLAGS)" \
+	-DCMAKE_C_FLAGS="$(FLUENT_BIT_CFLAGS)" \
+	-DCMAKE_CXX_FLAGS="$(FLUENT_BIT_CXXFLAGS)"
 
 define FLUENT_BIT_INSTALL_INIT_SYSV
 	$(INSTALL) -D -m 0755 package/fluent-bit/S99fluent-bit \
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Re: [Buildroot] [PATCH v2 3/3] package/fluent-bit: fix builds on s390x architectures

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"thomas" == thomas <[email protected]> writes:

From: Thomas Devoogdt <[email protected]>
Fixes:
- http://autobuild.buildroot.net/results/856fd250f75a696694c70e3208ffcef7470a7082
- http://autobuild.buildroot.net/results/dceb413fb5d459338417d8dd5a42d95aa23e849b

---
v2: new patch in this serie

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw
In reply to [email protected]
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"thomas" == thomas <[email protected]> writes:

From: Thomas Devoogdt <[email protected]>
- Release Notes:

    https://fluentbit.io/announcements/v2.0.9/
Quoted 7 lines

- Patch dropped, as it is upstream:

    https://github.com/fluent/fluent-bit/commit/7bcb502ebdcd647d6b83c972805e734ad522eb1a

---
v2: moved to a serie of patches

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot