Skip to content

bazel: Remove clang-libstdc++ toolchain and rationalize flags - #39755

Merged
agrawroh merged 3 commits into
envoyproxy:mainfrom
phlax:bazel-flags
Jun 11, 2025
Merged

agrawroh merged 3 commits into
envoyproxy:mainfrom
phlax:bazel-flags

Conversation

@phlax

@phlax phlax commented Jun 5, 2025 •

Copy link
Copy Markdown
Member
  • removes clang-libstdc++ toolchain (untested/unsupported)
  • renames clang-libc++ → clang throughout (breaking change)
  • consolidates duplicate bazel flags and fixes flag conflicts

this may be a little disruptive but it should resolve issues where libc++ and libstdc++ are getting mixed, and should hugely simplify our bazel setup moving forward

testing this uncovered various ~bugs/anomalies/conflicts - so hopefully these should be resolved

@phlax
phlax marked this pull request as draft June 5, 2025 09:50
@phlax
phlax force-pushed the bazel-flags branch 4 times, most recently from b69c7be to c9cae74 Compare June 5, 2025 13:41
@phlax

phlax commented Jun 5, 2025

Copy link
Copy Markdown
Member Author

/retest

@phlax

phlax commented Jun 6, 2025

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@phlax

phlax commented Jun 6, 2025

Copy link
Copy Markdown
Member Author

/retest

@phlax phlax changed the title [WIP] bazel/rc: Rationalize toolchain flags bazel/rc: Rationalize toolchain flags Jun 6, 2025
@phlax phlax changed the title bazel/rc: Rationalize toolchain flags [WIP] bazel/rc: Rationalize toolchain flags Jun 6, 2025
@phlax
phlax force-pushed the bazel-flags branch 11 times, most recently from 4399313 to 4c90813 Compare June 7, 2025 10:50
@phlax phlax changed the title [WIP] bazel/rc: Rationalize toolchain flags [WIP] bazel/rc: Rationalize toolchains/flags Jun 7, 2025
@phlax
phlax force-pushed the bazel-flags branch 2 times, most recently from dc1723d to 54c0190 Compare June 7, 2025 11:39
@phlax
phlax force-pushed the bazel-flags branch 4 times, most recently from 25fe4b8 to 44f79d4 Compare June 7, 2025 12:03
@phlax
phlax force-pushed the bazel-flags branch 2 times, most recently from 5c9acaa to 8ff8926 Compare June 8, 2025 19:25
@phlax

phlax commented Jun 8, 2025

Copy link
Copy Markdown
Member Author

cc @krinkinmu

Comment thread .bazelrc
build:asan --action_env=ENVOY_UBSAN_VPTR=1
build:asan --copt=-fsanitize=vptr,function
build:asan --linkopt=-fsanitize=vptr,function
build:asan --linkopt='-L/opt/llvm/lib/clang/18/lib/x86_64-unknown-linux-gnu'

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.

Why do we need this?

I might be missing something, but aren't sanitizer libraries are provided via Bazel now? And there should be no need to tell Clang where the toolchain and its libraries live.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

not for asan - not sure if we do really need it but this was how it was set before - this will obv go with hermetic toolchains

Comment thread .bazelrc
# ASAN config with clang runtime
build:asan --config=asan-common
build:asan --linkopt --rtlib=compiler-rt
build:asan --linkopt --unwindlib=libgcc

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.

I relalize it was there before, but it's a bit weird to have rtlib=compiler-rt and at the same time use libgcc as an unwinder, I think that compiler-rt is capabale of handling that job as well and we shouldn't need libgcc.

Not a blocker, but maybe worth filing a follow up bug to get rid of libgcc where compiler-rt is already available.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah makes sense - i think this may also be related to my discovery that we are using gcc runtime libs by default

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Signed-off-by: Ryan Northey <[email protected]>
@phlax

phlax commented Jun 9, 2025

Copy link
Copy Markdown
Member Author

/retest brew transient

@agrawroh agrawroh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! cc @abeyad Could you PTAL as well?

@abeyad abeyad left a comment

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.

LGTM, just had one question that I commented on

Comment thread .bazelrc
# silence absl logspam.
build --copt=-DABSL_MIN_LOG_LEVEL=4
# Global C++ standard and common warning suppressions
build --cxxopt=-std=c++20 --host_cxxopt=-std=c++20

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.

question: will this cause issues for Apple where we don't have xcode 16 yet? (because I noticed the c++20 was changed from Linux-specific to a global build flag)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

lmc - i think this bit happened when i was rationalizing flags that were setting same thing ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@abeyad abeyad left a comment

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.

awesome, thanks for checking @phlax !

@agrawroh
agrawroh merged commit 0a28910 into envoyproxy:main Jun 11, 2025
mum4k pushed a commit to envoyproxy/nighthawk that referenced this pull request Jun 21, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 1, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 1, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 1, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 1, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 1, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 2, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 2, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
asingh-g pushed a commit to asingh-g/nighthawk that referenced this pull request Jul 2, 2025
- Major .bazelrc update after envoyproxy/envoy#39755
  - Not taking the upstream update `build:linux --action_env=BAZEL_LINKOPTS=-lm:-fuse-ld=gold` which breaks my local `ci/do_ci.sh build` with `clang-18: error: invalid linker name in argument '-fuse-ld=gold'`
- `Http1PoolImpl` started taking an `OverloadManager` argument; created a `NullOverloadManager` in `NighthawkServerInstance` to be used for that

Signed-off-by: eric846 <[email protected]>
Signed-off-by: asingh-g <[email protected]>
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.

6 participants