Skip to content

[bzl/build] Specify clang-common config#1805

Open
nezdolik wants to merge 1 commit intomainfrom
nezdolik-patch-1
Open

[bzl/build] Specify clang-common config#1805
nezdolik wants to merge 1 commit intomainfrom
nezdolik-patch-1

Conversation

@nezdolik
Copy link
Copy Markdown

@nezdolik nezdolik commented Mar 17, 2026

When building locally cilium-envoy, cilium-envoy-starter via make install for linux amd64/arm64, compilation failed with:

clang-18: error: unsupported option '-pass-exit-codes'

this is because overriden clang version is not being propagated to the build:

ARGO_BAZEL_REPIN=true  bazel  build --platforms=//bazel:linux_aarch64 --config=release //:cilium-envoy

@nezdolik nezdolik requested a review from a team as a code owner March 17, 2026 13:04
@nezdolik nezdolik requested a review from mhofstetter March 17, 2026 13:04
Signed-off-by: Kateryna Nezdolii <kateryna.nezdolii@gmail.com>
@nezdolik nezdolik requested a review from jrajahalme March 19, 2026 09:13
BAZEL_BUILD_OPTS += --platforms=$(BAZEL_PLATFORM)

BAZEL_BUILD_OPTS += --config=clang

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.

IMO this would be better added to .bazelrc, right after importing envoy.bazelrc. Should also figure out if we need anything else from the generated clang.bazelrc file where this was already.

Copy link
Copy Markdown
Author

@nezdolik nezdolik Mar 19, 2026

Choose a reason for hiding this comment

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

not sure i fully understand/agree. We still need to tell bazel to use clang config when building cilium-envoy-proxy (by default it will use gcc). bazelrc file just contains different build configs. Or did you mean to include clang config into release config? E.g.

build:release --config=clang

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

but also may need some of those:

build:clang --action_env='PATH=${PATH}' --host_action_env='PATH=${PATH}'
build:clang --action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config' --host_action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --repo_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --linkopt='-L$(llvm-config --libdir)'
build:clang --linkopt='-Wl,-rpath,$(llvm-config --libdir)'

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.

It is OK to make all builds use clang, IMO. We no longer test any builds with GCC.

Either keep the current clang setup script and amend the Makefiles to use it on all targets, or remove it and figure out what of the generated clang.bazelrc has to be moved to .bazelrc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I will proceed with option 1 now (less effort). Envoy has switched to hermetic toolchain in https://github.com/envoyproxy/envoy/pull/39679/changes, this is smth we would benefit from as well.

@mhofstetter mhofstetter removed their request for review March 19, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants