Skip to contentSkip to conversation

package/fluent-bit: needs C++

PATCH In review Thomas Devoogdt 2 participants 5 messages Jan 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 package/fluent-bit: needs C++

From: Thomas Devoogdt <[email protected]>

Fixes:
- http://autobuild.buildroot.net/results/007/007c7c69e54b8ff663891da4535e2e95d40c42a2/build-end.log
- http://autobuild.buildroot.net/results/ede/ede6f9fb67c0c26ff02e71a3d20e3d4344ea59f0/build-end.log

---
v1 --> v2:
- added package/ prefix to the git message

 package/fluent-bit/Config.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/fluent-bit/Config.in +3 -2
index 11ceb55d4f..bd89c05faa 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_FLUENT_BIT
 	bool "fluent-bit"
+	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_LIBYAML
@@ -8,5 +9,5 @@ config BR2_PACKAGE_FLUENT_BIT
 
 	  https://github.com/fluent/fluent-bit
 
-comment "fluent-bit needs a glibc toolchain"
-	depends on !BR2_TOOLCHAIN_USES_GLIBC
+comment "fluent-bit needs a glibc toolchain w/ C++"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP
Signature · 6 lines
2.39.0

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

PATCH v2 2/3 package/fluent-bit: fix -latomic on various platforms

From: Thomas Devoogdt <[email protected]>

/home/thomas/br-test-pkg/bootlin-nios2-glibc/host/opt/ext-toolchain/bin/../lib/gcc/nios2-buildroot-linux-gnu/10.3.0/../../../../nios2-buildroot-linux-gnu/bin/ld: /tmp/fluent-bit.6F9rEA.ltrans28.ltrans.o: undefined reference to symbol '__atomic_compare_exchange_8@@LIBATOMIC_1.0' /home/thomas/br-test-pkg/bootlin-nios2-glibc/host/opt/ext-toolchain/bin/../lib/gcc/nios2-buildroot-linux-gnu/10.3.0/../../../../nios2-buildroot-linux-gnu/bin/ld: /home/thomas/br-test-pkg/bootlin-nios2-glibc/host/nios2-buildroot-linux-gnu/sysroot/lib/libatomic.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

---
v1 --> v2:
- added package/ prefix to the git message

 package/fluent-bit/fluent-bit.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/fluent-bit/fluent-bit.mk +6 -0
index f7727834dd..c84042a0fa 100644
@@ -41,6 +41,12 @@ FLUENT_BIT_CONF_OPTS += \
 	-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
 	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -U_FILE_OFFSET_BITS"
 
+# Uses __atomic_compare_exchange_8
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+FLUENT_BIT_CONF_OPTS += \
+	-DCMAKE_EXE_LINKER_FLAGS=-latomic
+endif
+
 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.39.0

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

PATCH v2 3/3 package/fluent-bit: needs arch support for wasm

In reply to Thomas Devoogdt

From: Thomas Devoogdt <[email protected]>

See:
https://github.com/fluent/fluent-bit/tree/master/lib/wasm-micro-runtime-WAMR-1.1.1#supported-architectures-and-platforms

MIPS & RISCV32 are mentioned in the supported list, but that seems to be wrong, so excluded those.

---
v1 --> v2:
- added package/ prefix to the git message

 package/fluent-bit/Config.in     | 11 +++++++++++
 package/fluent-bit/fluent-bit.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/fluent-bit/Config.in +11 -0
index bd89c05faa..0ed69e09ce 100644
@@ -11,3 +11,14 @@ config BR2_PACKAGE_FLUENT_BIT
 
 comment "fluent-bit needs a glibc toolchain w/ C++"
 	depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP
+
+if BR2_PACKAGE_FLUENT_BIT
+
+config BR2_PACKAGE_FLUENT_BIT_WASM
+	bool "Build with WASM runtime support"
+	default y
+	# see lib/wasm-micro-runtime-WAMR-1.1.1/README.md#supported-architectures-and-platforms
+	depends on BR2_i386 || BR2_x86_64 || BR2_arm || BR2_armeb || BR2_aarch64 || BR2_aarch64_be || \
+		(BR2_riscv && BR2_RISCV_64) || BR2_xtensa || BR2_arc
+
+endif
package/fluent-bit/fluent-bit.mk +6 -0
index c84042a0fa..6e9a33e02e 100644
@@ -17,6 +17,12 @@ FLUENT_BIT_CONF_OPTS += \
 	-DFLB_CHUNK_TRACE=No \
 	-DFLB_BACKTRACE=No
 
+ifeq ($(BR2_PACKAGE_FLUENT_BIT_WASM),y)
+FLUENT_BIT_CONF_OPTS += -DFLB_WASM=Yes
+else
+FLUENT_BIT_CONF_OPTS += -DFLB_WASM=No
+endif
+
 ifeq ($(BR2_PACKAGE_LUAJIT),y)
 FLUENT_BIT_CONF_OPTS += -DFLB_LUAJIT=Yes
 FLUENT_BIT_DEPENDENCIES += luajit
Signature · 6 lines
2.39.0

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

Re: [Buildroot] [PATCH v2 3/3] package/fluent-bit: needs arch support for wasm

\Thomas, All,

On 2023-01-29 10:45 +0100, Thomas Devoogdt spake thusly:

Quoted 24 lines

From: Thomas Devoogdt <[email protected]>

See:
https://github.com/fluent/fluent-bit/tree/master/lib/wasm-micro-runtime-WAMR-1.1.1#supported-architectures-and-platforms

MIPS & RISCV32 are mentioned in the supported list, but that seems to be wrong, so excluded those.

---
v1 --> v2:
- added package/ prefix to the git message

 package/fluent-bit/Config.in     | 11 +++++++++++
 package/fluent-bit/fluent-bit.mk |  6 ++++++
 2 files changed, 17 insertions(+)
package/fluent-bit/Config.in +0 -0
index bd89c05faa..0ed69e09ce 100644
@@ -11,3 +11,14 @@ config BR2_PACKAGE_FLUENT_BIT
 
 comment "fluent-bit needs a glibc toolchain w/ C++"

package/fluent-bit/Config.in config BR2_PACKAGE_FLUENT_BIT · line 22

Quoted 10 lines
package/fluent-bit/Config.in +9 -0
 	depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP
+
+if BR2_PACKAGE_FLUENT_BIT
+
+config BR2_PACKAGE_FLUENT_BIT_WASM
+	bool "Build with WASM runtime support"
+	default y
+	# see lib/wasm-micro-runtime-WAMR-1.1.1/README.md#supported-architectures-and-platforms
+	depends on BR2_i386 || BR2_x86_64 || BR2_arm || BR2_armeb || BR2_aarch64 || BR2_aarch64_be || \
+		(BR2_riscv && BR2_RISCV_64) || BR2_xtensa || BR2_arc

Long lists are not nice. You can achieve a better look with;

config BR2_PACKAGE_FLUENT_BIT_WASM
bool "WASM runtime support" depends in BR2_INSTALL_LIBSTDCPP default y if BR2_arc
default y if BR2_arm || BR2_armeb default y if BR2_aarch64 || BR2_aarch64_be default y if BR2_i386 || BR2_x86_64 default y if BR2_RISCV_64
default y if BR2_xtensa

Note that the C++ dependency from my review on patch 1/3 should fit here.

Also, BR2_RISCV_64 can only be set if BR2_riscv is already set, so "BR2_riscv && BR2_RISCV_64 == BR2_RISCV_64".

Regards,
Yann E. MORIN.

Quoted 25 lines
package/fluent-bit/Config.in +1 -0
+endif
package/fluent-bit/fluent-bit.mk +6 -0
index c84042a0fa..6e9a33e02e 100644
@@ -17,6 +17,12 @@ FLUENT_BIT_CONF_OPTS += \
 	-DFLB_CHUNK_TRACE=No \
 	-DFLB_BACKTRACE=No
 
+ifeq ($(BR2_PACKAGE_FLUENT_BIT_WASM),y)
+FLUENT_BIT_CONF_OPTS += -DFLB_WASM=Yes
+else
+FLUENT_BIT_CONF_OPTS += -DFLB_WASM=No
+endif
+
 ifeq ($(BR2_PACKAGE_LUAJIT),y)
 FLUENT_BIT_CONF_OPTS += -DFLB_LUAJIT=Yes
 FLUENT_BIT_DEPENDENCIES += luajit
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Thomas Devoogdt

Thomas, All,

On 2023-01-29 10:45 +0100, Thomas Devoogdt spake thusly:

Quoted 19 lines

From: Thomas Devoogdt <[email protected]>

Fixes:
- http://autobuild.buildroot.net/results/007/007c7c69e54b8ff663891da4535e2e95d40c42a2/build-end.log
- http://autobuild.buildroot.net/results/ede/ede6f9fb67c0c26ff02e71a3d20e3d4344ea59f0/build-end.log

---
v1 --> v2:
- added package/ prefix to the git message

 package/fluent-bit/Config.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/fluent-bit/Config.in +0 -0
index 11ceb55d4f..bd89c05faa 100644

package/fluent-bit/Config.in line 3

Quoted 3 lines
package/fluent-bit/Config.in +1 -0
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_FLUENT_BIT
 	bool "fluent-bit"
+	depends on BR2_INSTALL_LIBSTDCPP

Are you sure? The test that fails is that cmake can't find a C++ compiler, indeed.

But if we look at the source tree, we can see that fluent-bit itself is written in C, and that there are only 4 bundled libraries that have C++ source files:
- librdkafka, which is optional;
- c-ares, and it's only for tests;
- jemalloc, and C++ is only optional there;
- wasm-micro-runtime-WAMR, but that is only when targetting web-assembly, which we don't.

So, I thnk the test in CMakeFile.txt should be fixed to bot require C++ by default, and only enable C++ support when it is needed (i.e. just for the Kafka bacnkend?), and then in Buildroot, we disable the Kafka backend when we don;t have C++, and only enabke it when we do (or even add an option for it).

Looking at the kafka backend, it should also be possible to not require C++ for it, as it builds two libs, a C-ionly one, and a C++ one.

Regards,
Yann E. MORIN.

Quoted 18 lines
package/fluent-bit/Config.in +2 -2
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_LIBYAML
@@ -8,5 +9,5 @@ config BR2_PACKAGE_FLUENT_BIT
 
 	  https://github.com/fluent/fluent-bit
 
-comment "fluent-bit needs a glibc toolchain"
-	depends on !BR2_TOOLCHAIN_USES_GLIBC
+comment "fluent-bit needs a glibc toolchain w/ C++"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot