Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ build --cxxopt "-Wno-dangling" --host_cxxopt "-Wno-dangling"
build --per_file_copt=.*external/.*@-w
build --host_per_file_copt=.*external/.*@-w

# This avoid problems with building -c dbg which enables asserts.
# Without this libstdc++ vs libc++ differences cause link errors.
build --per_file_copt=.*external/abc.*@-stdlib=libc++
build --host_per_file_copt=.*external/abc.*@-stdlib=libc++
Comment on lines +68 to +71

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Forcing libc++ for a specific external dependency via per_file_copt is a workaround for a broader inconsistency. If the project is intended to use libc++ globally (as suggested by the linker errors and the -libcxx_assertions feature in BUILD.bazel), it is more robust to configure this in the toolchain definition within MODULE.bazel using the stdlib = "libc++" attribute on the llvm.toolchain extension. This ensures consistency across all dependencies and avoids potential ODR violations that can occur when mixing standard library implementations. Additionally, there is a small typo in the comment ("avoid" should be "avoids").

# This avoids problems with building -c dbg which enables asserts.
# Without this libstdc++ vs libc++ differences cause link errors.
build --per_file_copt=.*external/abc.*@-stdlib=libc++
build --host_per_file_copt=.*external/abc.*@-stdlib=libc++


##### Platform-specific configs (auto-selected) #############
# --enable_platform_specific_config makes bazel automatically apply
# build:macos on macOS, build:linux on Linux, etc.
Expand Down
Loading