lib: librdkafka: only require a C compiler - #10341
ThomasDevoogdt wants to merge 2 commits into
Conversation
e69a7aa to
d9a9108
Compare
d9a9108 to
0a124d4
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CXX-disabled compilation workflow no longer installs ChangesCI Kafka dependency removal
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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++ availabilityEven without the
option()call, a cache entry like-DRDKAFKA_BUILD_TESTS=ONkeeps this block true. On hosts lacking a usable C++ toolchain (the exact case this PR targets), we would still dive intoadd_subdirectory(tests)and the build fails. Please guard this block with the sameCMAKE_CXX_COMPILERcheck used forsrc-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
📒 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++)
| include(CheckLanguage) | ||
| check_language(CXX) | ||
| if(CMAKE_CXX_COMPILER) | ||
| enable_language(CXX) | ||
| else() | ||
| message(STATUS "C++ compiler not found, skipping C++ support") | ||
| endif() |
There was a problem hiding this comment.
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.
|
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. |
0a124d4 to
16d53c5
Compare
|
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. |
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>
16d53c5 to
5e875e5
Compare
Upstream: confluentinc/librdkafka#4366
Summary by CodeRabbit