Skip to content

lib: librdkafka: only require a C compiler - #10341

Open
ThomasDevoogdt wants to merge 2 commits into
fluent:masterfrom
ThomasDevoogdt:bugfix/lib-kafka-only-require-a-c-compiler
Open

ThomasDevoogdt wants to merge 2 commits into
fluent:masterfrom
ThomasDevoogdt:bugfix/lib-kafka-only-require-a-c-compiler

Conversation

@ThomasDevoogdt

@ThomasDevoogdt ThomasDevoogdt commented May 16, 2025 •

Copy link
Copy Markdown
Contributor

Upstream: confluentinc/librdkafka#4366

Summary by CodeRabbit

  • Chores
    • Updated pull request compilation checks to use the default Kafka-library selection.
    • Removed the Kafka development package from the check’s system package setup.

@coderabbitai

coderabbitai Bot commented Oct 4, 2025 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b04c28b6-b478-4a12-839a-5bd0f9198e4f
📥 Commits

Reviewing files that changed from the base of the PR and between 5e875e5 and 354d4bb.

📒 Files selected for processing: 1
  • .github/workflows/pr-compile-check.yaml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The CXX-disabled compilation workflow no longer installs librdkafka-dev or sets FLB_PREFER_SYSTEM_LIB_KAFKA=ON. The system Zstandard preference remains enabled.

Changes: CI Kafka dependency removal

Layer / File(s) Summary
Update CXX-disabled compilation workflow
.github/workflows/pr-compile-check.yaml
The job no longer installs librdkafka-dev or passes -DFLB_PREFER_SYSTEM_LIB_KAFKA=ON. It continues to prefer the system Zstandard library.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 354d4

The CI job can build with bundled librdkafka without requiring a C++ compiler; no actionable merge-blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely states the main change: librdkafka requires only a C compiler.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/librdkafka-2.10.1/CMakeLists.txt (1)

304-307: Also gate tests on actual C++ availability

Even without the option() call, a cache entry like -DRDKAFKA_BUILD_TESTS=ON keeps this block true. On hosts lacking a usable C++ toolchain (the exact case this PR targets), we would still dive into add_subdirectory(tests) and the build fails. Please guard this block with the same CMAKE_CXX_COMPILER check used for src-cpp, e.g.:

-if(RDKAFKA_BUILD_TESTS)
+if(CMAKE_CXX_COMPILER AND RDKAFKA_BUILD_TESTS)
   enable_testing()
   add_subdirectory(tests)
 endif()
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d9593e and 0a124d4.

📒 Files selected for processing (3)
  • .github/workflows/pr-compile-check.yaml (2 hunks)
  • lib/librdkafka-2.10.1/CMakeLists.txt (3 hunks)
  • lib/librdkafka-2.10.1/examples/CMakeLists.txt (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: ThomasDevoogdt
PR: fluent/fluent-bit#9277
File: .github/workflows/pr-compile-check.yaml:147-151
Timestamp: 2025-08-31T12:46:11.940Z
Learning: In fluent-bit, the correct CMake flag for using system librdkafka is `FLB_PREFER_SYSTEM_LIB_KAFKA=ON`.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_ARROW=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_COVERAGE=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, clang, clang++)

Comment on lines +9 to +15
include(CheckLanguage)
check_language(CXX)
if(CMAKE_CXX_COMPILER)
enable_language(CXX)
else()
message(STATUS "C++ compiler not found, skipping C++ support")
endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Handle bogus CXX values before calling enable_language

When CXX is preset to something non-working (e.g. our no-C++ workflow exports /bin/false), check_language(CXX) still leaves CMAKE_CXX_COMPILER pointing at that path instead of *-NOTFOUND. The current if (CMAKE_CXX_COMPILER) conditional therefore fires and enable_language(CXX) aborts configuration, defeating the “C-only” fallback we’re trying to enable. Please tighten the guard so we only enable C++ when CMAKE_CXX_COMPILER is both defined and not *-NOTFOUND. One way is:

-check_language(CXX)
-if(CMAKE_CXX_COMPILER)
+check_language(CXX)
+if(CMAKE_CXX_COMPILER AND NOT CMAKE_CXX_COMPILER MATCHES "-NOTFOUND$")
   enable_language(CXX)
 else()
   message(STATUS "C++ compiler not found, skipping C++ support")
 endif()
🤖 Prompt for AI Agents
In lib/librdkafka-2.10.1/CMakeLists.txt around lines 9-15, the current guard
uses if(CMAKE_CXX_COMPILER) which can be true for bogus values like /bin/false
left by check_language(CXX), causing enable_language(CXX) to abort; change the
conditional to only enable C++ when the compiler is both defined and not a
NOTFOUND marker, e.g. use if(DEFINED CMAKE_CXX_COMPILER AND NOT
CMAKE_CXX_COMPILER MATCHES "-NOTFOUND$") then enable_language(CXX) else emit the
existing status message.

@github-actions

github-actions Bot commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Jan 3, 2026
@ThomasDevoogdt
ThomasDevoogdt force-pushed the bugfix/lib-kafka-only-require-a-c-compiler branch from 0a124d4 to 16d53c5 Compare March 7, 2026 17:50
@github-actions github-actions Bot removed the Stale label Mar 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the Stale label Jun 11, 2026
@ThomasDevoogdt
ThomasDevoogdt force-pushed the bugfix/lib-kafka-only-require-a-c-compiler branch from 16d53c5 to 5e875e5 Compare August 4, 2026 13:55
@github-actions github-actions Bot removed the Stale label Aug 5, 2026
ThomasDevoogdt and others added 2 commits October 18, 2026 18:30
Upstream: confluentinc/librdkafka#4366
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
This reverts commit 32fc9dd.

Not needed anymore since librdkafka has been fixed.

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
@ThomasDevoogdt
ThomasDevoogdt force-pushed the bugfix/lib-kafka-only-require-a-c-compiler branch from 5e875e5 to 354d4bb Compare October 18, 2026 16:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant