Skip to content

Conversation

@mabrarov
Copy link
Contributor

@mabrarov mabrarov commented Jan 26, 2026

Summary

  • Fixed C/C++ compiler options in CMake project especially when MSVC is used (e.g. fixed passing preprocessor definitions required for Windows containers failing to build #10158).
  • Fixed (formatting, build command) development guide for Windows.
  • Fixed support of "Visual Studio" CMake Generators - refer to Windows containers failing to build #10158.
    Note: multi-config CMake Generators (like "Visual Studio" ones) can still have issues due to Fluent Bit CMake project doesn't honor and doesn't support the build type(s) specified when CMake generates native build system project - e.g. CMAKE_BUILD_TYPE passed through command line and CMAKE_CONFIGURATION_TYPES. Support of multi-config CMake Generators can require usage of CMake generator expressions everywhere build-config specific compiler / linker options are added / modified, can require revisiting of the way linked libraries are specified, e.g. they should not use -l option with hard-coded name of static library file, because the name of library file can depend on build configuration on Windows - e.g. libcrypto.lib for Release and RelWithDebInfo builds with /MT compiler option (static release MS C/C++ runtime) vs libcryptod.lib for Debug build with /MTd compiler option (static debug MS C/C++ runtime).
  • Fixed parallel build of Fluent Bit when building docker image for Windows containers.
  • Fixed "negative coverage" error when collecting test coverage with coverage profiled build.

Testing

Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change.
  • [N/A] Debug log output from testing the change.
  • Attached Valgrind output that shows no leaks or memory corruption was found - refer to flb_run_code_analysis.log for the output of command
    TEST_PRESET=valgrind SKIP_TESTS='flb-rt-out_td flb-it-network' ./run_code_analysis.sh
  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature.

Backporting

  • [N/A] Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Build & Infrastructure

    • Switched Windows builds to Ninja for faster, consistent builds.
    • Added deferred C++ flag holders to apply compiler/linker flags only when C++ is enabled.
    • Updated MSVC handling: enable UTF‑8 encoding, adjust static runtime behavior and per-config flags, and make debug option off for MSVC builds.
    • Adjusted ARM/FreeBSD linker flag handling for edge cases.
  • Documentation

    • Clarified Windows build command to explicitly use Release configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Adds delayed-extension variables for C++ compile/link flags and applies them when C++ is enabled; adjusts MSVC runtime handling and enables UTF‑8; switches Windows CI/build to Ninja and updates Windows build invocation in the developer guide.

Changes

Cohort / File(s) Summary
Top-level CMake flag orchestration
CMakeLists.txt
Adds FLB_EXTRA_CMAKE_CXX_FLAGS and FLB_EXTRA_CMAKE_CXX_LINK_FLAGS; defers merging extra C++ flags/link-flags until C++ is enabled; applies MSVC-specific runtime and /utf-8 encoding handling; makes MK_DEBUG ON only when not MSVC.
Onigmo MSVC adjustments
lib/onigmo/CMakeLists.txt
Adjusts MSVC runtime selection to prefer MT/MTd (uses CMAKE_MSVC_RUNTIME_LIBRARY when available); transforms per-config CFLAGS to MT variants; adds /utf-8; removes forced CMAKE_BUILD_TYPE None and previous forced -DNDEBUG/-O2.
Windows Docker build image
dockerfiles/Dockerfile.windows
Installs Ninja (download, extract, PATH persistence) and switches builder stage to Ninja generator; removes explicit -DCMAKE_BUILD_TYPE=Release and replaces NMake build steps with Ninja semantics.
Developer guide / Windows build doc
DEVELOPER_GUIDE.md
Changes Windows build command to include --config Release in cmake --build invocation; formatting adjustments to PowerShell/JSON blocks.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • edsiper
  • cosmo0920
  • patrick-stephens
  • fujimotos
  • niedbalski
  • celalettin1286

Poem

🐰 I hopped through flags and CMake vines,

MT threads stitched where the runtime shines,
Ninja arrived with a nimble cheer,
UTF‑8 whispers made builds clear,
Delayed flags woke when C++ signs.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing CMake project issues for the MSVC compiler with C/C++ compiler options, runtime library, encoding, and generator support improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@mabrarov mabrarov marked this pull request as ready for review January 26, 2026 20:05
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Signed-off-by: Marat Abrarov <abrarov@gmail.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@CMakeLists.txt`:
- Around line 57-63: The unconditional set of FLB_EXTRA_CMAKE_CXX_FLAGS and
FLB_EXTRA_CMAKE_CXX_LINK_FLAGS is shadowing command-line -D overrides; change
the initialization so caller-provided values are preserved by either (a)
wrapping the current set calls with if(NOT DEFINED FLB_EXTRA_CMAKE_CXX_FLAGS) /
if(NOT DEFINED FLB_EXTRA_CMAKE_CXX_LINK_FLAGS) or (b) declare them as cache
variables (e.g., set(FLB_EXTRA_CMAKE_CXX_FLAGS "" CACHE STRING "extra CXX
flags") and set(FLB_EXTRA_CMAKE_CXX_LINK_FLAGS "" CACHE STRING "extra CXX link
flags")) so later appends (e.g., where FLB_EXTRA_CMAKE_CXX_LINK_FLAGS is
extended with -latomic) will honor -D overrides; update the existing set(...)
lines around FLB_EXTRA_CMAKE_CXX_FLAGS and FLB_EXTRA_CMAKE_CXX_LINK_FLAGS
accordingly.

In `@dockerfiles/Dockerfile.windows`:
- Around line 86-104: The RUN block that downloads Ninja (variables
NINJA_VERSION, NINJA_URL, NINJA_HOME and local vars $ninja_dist_name,
$ninja_dist, $ninja_download_url) lacks SHA256 validation; after
Invoke-WebRequest and before Expand-Archive compute the SHA256 of ${ninja_dist}
with Get-FileHash -Algorithm SHA256 and compare it against the known digest
07fc8261b42b20e71d1720b39068c2e14ffcee6396b76fb7a795fb460b78dc65, and if they
differ throw an error/exit the build (e.g. throw or [Environment]::Exit(1)) to
prevent extraction; keep the rest of the flow (Remove-Item, Expand-Archive, PATH
and SetEnvironmentVariable) unchanged.

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