build: do not embed the build directory in the binary#12077
Conversation
monkey, cfl, ctraces and cmetrics define __FILENAME__/__CMT_FILENAME__ via a
GNU Make expression that only the Make generator expands; under Ninja the
literal string, including the absolute ${CMAKE_SOURCE_DIR}, is baked into every
object file. Use plain __FILE__ as the Windows branch already does, and drop
the then-identical conditional.
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFour CMakeLists.txt build files (lib/cfl, lib/cmetrics, lib/ctraces, lib/monkey) are updated to remove OS-conditional logic for defining filename macros (FILENAME, CMT_FILENAME). Each now unconditionally defines the macro as FILE via CMAKE_C_FLAGS, replacing the previous non-Windows path-stripping expressions. ChangesCMake filename macro simplification
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
The CI in OpenWrt discovered that we're getting hard-coded paths. Related |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11305c8d17
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| else() | ||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") | ||
| endif() | ||
| set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") |
There was a problem hiding this comment.
Map FILE before using it as FILENAME
When building with CMake's Ninja/Make generators, the compile rule passes absolute source paths, so this definition makes every cfl_report_runtime_error() expansion store and print paths like /workspace/fluent-bit/lib/cfl/src/cfl_kv.c in release objects. That leaves the absolute-path leakage this change is trying to remove, and the same replacement pattern appears in cmetrics/ctraces/monkey; use a generator-independent prefix map or relative per-source definition instead.
Useful? React with 👍 / 👎.
monkey, cfl, ctraces and cmetrics define FILENAME/CMT_FILENAME via a GNU Make expression that only the Make generator expands; under Ninja the literal string, including the absolute ${CMAKE_SOURCE_DIR}, is baked into every object file. Use plain FILE as the Windows branch already does, and drop the then-identical conditional.
Summary by CodeRabbit