Skip to contentSkip to conversation

fluentbit: Use CMAKE_C_STANDARD_LIBRARIES cmake var to pass libatomic

PATCH New Khem Raj 1 participant 2 messages Aug 19, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 fluentbit: Use CMAKE_C_STANDARD_LIBRARIES cmake var to pass libatomic

Since libatomic needs to be linked last in the list of libs, take advantange of using CMAKE_C_STANDARD_LIBRARIES insread of FLB_DEPS since DFLB_DEPS is not appended last to linker flags in CMakefiles it ends up with undefined references for libatomic symbols in libs appearing after FLB_LIBS in sequence

Use it for mips too

---
 meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb +3 -2
index ea6f81cbf0..a801694f42 100644
@@ -75,8 +75,9 @@ 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'"
+EXTRA_OECMAKE:append:riscv64 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
+EXTRA_OECMAKE:append:riscv32 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
+EXTRA_OECMAKE:append:mips = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
 
 inherit cmake systemd pkgconfig
 
Signature · 1 line
2.37.2
author
#1 lore raw

PATCH 2/2 fluentbit: Upgrade to 1.9.7 and fix build on x86

---
 ...emove-unused-variable-in-mpi_mul_hlp.patch | 42 +++++++++++++++++++
 ...{fluentbit_1.9.6.bb => fluentbit_1.9.7.bb} |  7 +++-
 2 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-extended/fluentbit/fluentbit/0001-Revert-Remove-unused-variable-in-mpi_mul_hlp.patch
 rename meta-oe/recipes-extended/fluentbit/{fluentbit_1.9.6.bb => fluentbit_1.9.7.bb} (92%)
meta-oe/recipes-extended/fluentbit/fluentbit/0001-Revert-Remove-unused-variable-in-mpi_mul_hlp.patch new file +42 -0
new file mode 100644
index 0000000000..8a165dc0d2
@@ -0,0 +1,42 @@
+From af6cefba8c2675f58b75f93785337ab23054568c Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 18 Aug 2022 23:35:23 -0700
+Subject: [PATCH] Revert Remove unused variable in mpi_mul_hlp()
+
+This reverts
+https://github.com/Mbed-TLS/mbedtls/commit/e7f14a3090e6595eb3c8d821704ad9c90f6d3712
+
+Which helps in compiling the x86 asm code.
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ lib/mbedtls-2.28.0/library/bignum.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/lib/mbedtls-2.28.0/library/bignum.c b/lib/mbedtls-2.28.0/library/bignum.c
+index 9c256ae..62e7f76 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;
++    mbedtls_mpi_uint c = 0, t = 0;
+ 
+ #if defined(MULADDC_HUIT)
+     for( ; i >= 8; i -= 8 )
+@@ -1443,6 +1443,8 @@ void mpi_mul_hlp( size_t i,
+     }
+ #endif /* MULADDC_HUIT */
+ 
++    t++;
++
+     while( c != 0 )
+     {
+         *d += c; c = ( *d < c ); d++;
+-- 
+2.37.2
+
meta-oe/recipes-extended/fluentbit/fluentbit_1.9.7.bb renamed from meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb +5 -2
similarity index 92%
rename from meta-oe/recipes-extended/fluentbit/fluentbit_1.9.6.bb
rename to meta-oe/recipes-extended/fluentbit/fluentbit_1.9.7.bb
index a801694f42..a1f879488d 100644
@@ -22,13 +22,13 @@ SRC_URI = "https://releases.fluentbit.io/1.9/source-${PV}.tar.gz;subdir=fluent-b
            file://0004-Use-correct-type-to-store-return-from-flb_kv_item_cr.patch \
            file://0005-stackdriver-Fix-return-type-mismatch.patch \
            file://0006-monkey-Fix-TLS-detection-testcase.patch \
+           file://0001-Revert-Remove-unused-variable-in-mpi_mul_hlp.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"
-
+SRC_URI[sha256sum] = "8ca2ac081d7eee717483c06608adcb5e3d5373e182ad87dba21a23f8278c6540"
 S = "${WORKDIR}/fluent-bit-${PV}"
 
 DEPENDS = "zlib bison-native flex-native openssl"
@@ -78,6 +78,9 @@ EXTRA_OECMAKE:append:libc-musl = ' -DFLB_JEMALLOC_OPTIONS="--with-jemalloc-prefi
 EXTRA_OECMAKE:append:riscv64 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
 EXTRA_OECMAKE:append:riscv32 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
 EXTRA_OECMAKE:append:mips = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
+EXTRA_OECMAKE:append:x86 = " -DCMAKE_C_STANDARD_LIBRARIES=-latomic"
+
+CFLAGS:append:x86 = " -DMBEDTLS_HAVE_SSE2"
 
 inherit cmake systemd pkgconfig
 
Signature · 1 line
2.37.2