Skip to content

Kafka support needs a toolchain w/ C++ #7741

@ThomasDevoogdt

Description

@ThomasDevoogdt

Bug Report

While building fluent-bit on buildroot, I saw some build failures for toolchains that are lacking C++ support.
Kafka needs a C++ compiler to get compiled, but given the C codebase, it should be possible to compile it without.

In buildroot, I will have to add this patch to get fluent-bit compiled without Kafka.

commit ed44ebc2d4065ee75036c18b84fdaafec57eaeab (HEAD -> thode/bump-fluent-bit, thode/thode/bump-fluent-bit)
Author: Thomas Devoogdt <[email protected]>
Date:   Sun Jul 23 21:05:11 2023 +0200

    package/fluent-bit: fix Kafka compilation if no cxx compiler
    
    FLB_{IN,OUT}_KAFKA is enabled by default since v2.1.5,
    causing compile errors if no cxx support.
    
    - https://github.com/fluent/fluent-bit/commit/a36cde163db1d882af6714a2a8690060e877d767
    - https://github.com/confluentinc/librdkafka/blob/e75de5be191b6b8e9602efc969f4af64071550de/CMakeLists.txt#L282
    
    Signed-off-by: Thomas Devoogdt <[email protected]>

diff --git a/package/fluent-bit/fluent-bit.mk b/package/fluent-bit/fluent-bit.mk
index c863e62fdb..63d4346172 100644
--- a/package/fluent-bit/fluent-bit.mk
+++ b/package/fluent-bit/fluent-bit.mk
@@ -22,6 +22,17 @@ FLUENT_BIT_CONF_OPTS += \
        -DFLB_PREFER_SYSTEM_LIBS=Yes \
        -DFLB_BACKTRACE=No
 
+# Kafka support needs a toolchain w/ C++
+ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
+FLUENT_BIT_CONF_OPTS += \
+        -DFLB_IN_KAFKA=Yes \
+        -DFLB_OUT_KAFKA=Yes
+else
+FLUENT_BIT_CONF_OPTS += \
+        -DFLB_IN_KAFKA=No \
+        -DFLB_OUT_KAFKA=No
+endif
+
 # WASM runtime support needs a toolchain w/ C++
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)

To Reproduce

  • Steps to reproduce the problem:
$ git clone https://github.com/buildroot/buildroot
$ cd buildroot
$ ./utils/test-pkg -p fluent-bit -a

Expected behavior
Compilation should succeed for all the targets.

Your Environment

  • Version used: buildroot nightly
  • Configuration: N/A
  • Server type and version: N/A

Logs
http://autobuild.buildroot.org/?reason=fluent-bit-2.1.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions