Repository navigation
compat/openssl: select the prefixer's libstdc++ by architecture - #49166
Merged
phlax merged 2 commits intoNov 12, 2026
Merged
Conversation
The `prefixer` links the hermetic GCC runtime's `libstdc++.a` (`//compat/openssl/prefixer:libstdcxx`), which defaulted to `@gcc_runtime_linux_x86_64`. On a Linux aarch64 host the tool is built for aarch64 but linked against the x86_64 archive, so `--config=openssl` fails with `libstdc++.a(...) is incompatible with elf64-littleaarch64`. Declare `gcc_runtime_linux_aarch64` (toolshed's `gcc_extension` already supports `arch = "aarch64"`) and make the flag's default follow the CPU via an `alias` and a `select`. The x86_64 default is unchanged. Fixes envoyproxy#49165 Signed-off-by: Cong Son <[email protected]>
zirconnotfound
temporarily deployed
to
external-contributors
November 11, 2026 04:22 — with
GitHub Actions
Inactive
|
Hi @zirconnotfound, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
phlax
reviewed
Nov 11, 2026
phlax
left a comment
Member
There was a problem hiding this comment.
thanks @zirconnotfound lets drop the changelog and land
| @@ -0,0 +1,4 @@ | |||
| Fixed ``--config=openssl`` builds on Linux ``aarch64`` hosts, where the ``compat/openssl`` | |||
Member
There was a problem hiding this comment.
probabkly we can skip adding a changelog here - we do add sometimes for build changes - but not sure this qualifies
Contributor
Author
There was a problem hiding this comment.
thanks for reviewing. i thought that was necessary so i kept it in my commit.
i've pushed another commit to drop it, please let me know if anything else was raised
Signed-off-by: Cong Son <[email protected]>
zirconnotfound
temporarily deployed
to
external-contributors
November 12, 2026 01:28 — with
GitHub Actions
Inactive
Member
|
/retest flakey infra |
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
…yproxy#49166) The `prefixer` links the hermetic GCC runtime's `libstdc++.a` (`//compat/openssl/prefixer:libstdcxx`), which defaulted to `@gcc_runtime_linux_x86_64`. On a Linux aarch64 host the tool is built for aarch64 but linked against the x86_64 archive, so `--config=openssl` fails with `libstdc++.a(...) is incompatible with elf64-littleaarch64`. Declare `gcc_runtime_linux_aarch64` (toolshed's `gcc_extension` already supports `arch = "aarch64"`) and make the flag's default follow the CPU via an `alias` and a `select`. The x86_64 default is unchanged. Additional Description: - `build_setting_default` of a `label_flag` cannot be a `select`, hence the `alias`. - The `select` is evaluated in the configuration the `prefixer` is built for, so an aarch64 build picks the aarch64 runtime and any other CPU keeps the previous x86_64 default. - aarch64 builds now fetch toolshed's aarch64 GCC runtime archive for the `prefixer`. - No C++ is added, so there is no unit test or coverage to add (CONTRIBUTING.md asks for an explanation when 100% coverage is not possible). This is a BUILD/MODULE-only change that is verified by building. - Related: envoyproxy#48840 and envoyproxy#39632 introduced the hermetic libstdc++ but kept an x86_64-only default. - AI assistance: this change was drafted and tested with the help of Claude Code. I reviewed it and understand every line of it, and I will answer review comments myself. Risk Level: Low (build configuration of a build-time tool; the default branch is unchanged). Testing: Manual, on a Linux aarch64 host (NVIDIA BlueField-3 DPU), Bazel 9.3.2, from a clean output base, with this commit on top of `main` 363c84b (`envoy_toolshed` 0.5.20): ``` bazel build -c opt --config=openssl //compat/openssl/prefixer:prefixer //compat/openssl:prefixed_ossl_source //compat/openssl:bssl-compat ``` - After: the build completes successfully (2861 actions). - After: `file` on the `prefixer` reports `ELF 64-bit LSB pie executable, ARM aarch64`, and the `CppLink` action of the `prefixer` (`bazel aquery`) references only `gcc_runtime_linux_aarch64/aarch64-linux/lib64/libstdc++.a`. - After: the only `gcc_runtime` and `llvm_minimal` repositories in the output base are `gcc_runtime_linux_aarch64` and `llvm_minimal_linux_arm64`; the x86_64 ones are not fetched. - Before (same host, `main` without this change, earlier base 93aab93): `//compat/openssl/prefixer:prefixer` fails with `libstdc++.a(...) is incompatible with elf64-littleaarch64`. Not tested: a full `//source/exe:envoy-static` build, x86_64 hosts (left to CI), cross-compilation. Docs Changes: N/A (`bazel/SSL.md` already lists aarch64 as supported for OpenSSL). Platform Specific Features: Linux aarch64 only; other platforms are unchanged. Fixes envoyproxy#49165 --------- Signed-off-by: Cong Son <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
that referenced
this pull request
Nov 12, 2026
The `prefixer` links the hermetic GCC runtime's `libstdc++.a` (`//compat/openssl/prefixer:libstdcxx`), which defaulted to `@gcc_runtime_linux_x86_64`. On a Linux aarch64 host the tool is built for aarch64 but linked against the x86_64 archive, so `--config=openssl` fails with `libstdc++.a(...) is incompatible with elf64-littleaarch64`. Declare `gcc_runtime_linux_aarch64` (toolshed's `gcc_extension` already supports `arch = "aarch64"`) and make the flag's default follow the CPU via an `alias` and a `select`. The x86_64 default is unchanged. Additional Description: - `build_setting_default` of a `label_flag` cannot be a `select`, hence the `alias`. - The `select` is evaluated in the configuration the `prefixer` is built for, so an aarch64 build picks the aarch64 runtime and any other CPU keeps the previous x86_64 default. - aarch64 builds now fetch toolshed's aarch64 GCC runtime archive for the `prefixer`. - No C++ is added, so there is no unit test or coverage to add (CONTRIBUTING.md asks for an explanation when 100% coverage is not possible). This is a BUILD/MODULE-only change that is verified by building. - Related: #48840 and #39632 introduced the hermetic libstdc++ but kept an x86_64-only default. - AI assistance: this change was drafted and tested with the help of Claude Code. I reviewed it and understand every line of it, and I will answer review comments myself. Risk Level: Low (build configuration of a build-time tool; the default branch is unchanged). Testing: Manual, on a Linux aarch64 host (NVIDIA BlueField-3 DPU), Bazel 9.3.2, from a clean output base, with this commit on top of `main` 363c84b (`envoy_toolshed` 0.5.20): ``` bazel build -c opt --config=openssl //compat/openssl/prefixer:prefixer //compat/openssl:prefixed_ossl_source //compat/openssl:bssl-compat ``` - After: the build completes successfully (2861 actions). - After: `file` on the `prefixer` reports `ELF 64-bit LSB pie executable, ARM aarch64`, and the `CppLink` action of the `prefixer` (`bazel aquery`) references only `gcc_runtime_linux_aarch64/aarch64-linux/lib64/libstdc++.a`. - After: the only `gcc_runtime` and `llvm_minimal` repositories in the output base are `gcc_runtime_linux_aarch64` and `llvm_minimal_linux_arm64`; the x86_64 ones are not fetched. - Before (same host, `main` without this change, earlier base 93aab93): `//compat/openssl/prefixer:prefixer` fails with `libstdc++.a(...) is incompatible with elf64-littleaarch64`. Not tested: a full `//source/exe:envoy-static` build, x86_64 hosts (left to CI), cross-compilation. Docs Changes: N/A (`bazel/SSL.md` already lists aarch64 as supported for OpenSSL). Platform Specific Features: Linux aarch64 only; other platforms are unchanged. Fixes #49165 --------- Signed-off-by: Cong Son <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message:
compat/openssl: select the prefixer's libstdc++ by architecture
The
prefixerlinks the hermetic GCC runtime'slibstdc++.a(//compat/openssl/prefixer:libstdcxx), which defaulted to@gcc_runtime_linux_x86_64. On a Linux aarch64 host the tool is built for aarch64 but linked against the x86_64 archive, so--config=opensslfails withlibstdc++.a(...) is incompatible with elf64-littleaarch64.Declare
gcc_runtime_linux_aarch64(toolshed'sgcc_extensionalready supportsarch = "aarch64") and make the flag's default follow the CPU via analiasand aselect. The x86_64 default is unchanged.Additional Description:
build_setting_defaultof alabel_flagcannot be aselect, hence thealias.selectis evaluated in the configuration theprefixeris built for, so an aarch64 build picks the aarch64 runtime and any other CPU keeps the previous x86_64 default.prefixer.gcctoolchains #39632 introduced the hermetic libstdc++ but kept an x86_64-only default.Risk Level: Low (build configuration of a build-time tool; the default branch is unchanged).
Testing:
Manual, on a Linux aarch64 host (NVIDIA BlueField-3 DPU), Bazel 9.3.2, from a clean output base, with this commit on top of
main363c84b (envoy_toolshed0.5.20):fileon theprefixerreportsELF 64-bit LSB pie executable, ARM aarch64, and theCppLinkaction of theprefixer(bazel aquery) references onlygcc_runtime_linux_aarch64/aarch64-linux/lib64/libstdc++.a.gcc_runtimeandllvm_minimalrepositories in the output base aregcc_runtime_linux_aarch64andllvm_minimal_linux_arm64; the x86_64 ones are not fetched.mainwithout this change, earlier base 93aab93)://compat/openssl/prefixer:prefixerfails withlibstdc++.a(...) is incompatible with elf64-littleaarch64.Not tested: a full
//source/exe:envoy-staticbuild, x86_64 hosts (left to CI), cross-compilation.Docs Changes: N/A (
bazel/SSL.mdalready lists aarch64 as supported for OpenSSL).Release Notes:
changelogs/current/bug_fixes/build__openssl-prefixer-aarch64.rstPlatform Specific Features: Linux aarch64 only; other platforms are unchanged.
Fixes #49165