Repository navigation
compat/openssl: statically link libstdc++ in the prefixer - #48840
Merged
jwendell merged 1 commit intoOct 29, 2026
Merged
Conversation
The prefixer is an exec-config tool compiled against the gcc headers from envoy_toolshed's libstdcxx sysroot, so its objects reference that gcc's GLIBCXX symbol versions. Linking libstdc++ dynamically makes the tool require those versions from the build host's libstdc++.so.6 at runtime, so it aborts with "GLIBCXX_<ver> not found" on any host whose system libstdc++ is older than the sysroot's gcc. Link the matching static libstdc++.a (already shipped in the -L dir and already a linker input via @libstdcxx_sysroot_linux_amd64//:libs) so the tool is self-contained. libclang-cpp stays dynamic and resolves its own libstdc++ needs from the host. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Jonh Wendell <[email protected]>
phlax
approved these changes
Oct 29, 2026
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 9, 2026
…#48840) The prefixer is an exec-config tool compiled against the gcc headers from envoy_toolshed's libstdcxx sysroot, so its objects reference that gcc's GLIBCXX symbol versions. Linking libstdc++ dynamically makes the tool require those versions from the build host's libstdc++.so.6 at runtime, so it aborts with "GLIBCXX_<ver> not found" on any host whose system libstdc++ is older than the sysroot's gcc. Link the matching static libstdc++.a (already shipped in the -L dir and already a linker input via @libstdcxx_sysroot_linux_amd64//:libs) so the tool is self-contained. libclang-cpp stays dynamic and resolves its own libstdc++ needs from the host. Signed-off-by: Jonh Wendell <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> (cherry picked from commit 468dfec) Signed-off-by: Ryan Northey <[email protected]>
This was referenced Nov 11, 2026
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 11, 2026
…#48840) The prefixer is an exec-config tool compiled against the gcc headers from envoy_toolshed's libstdcxx sysroot, so its objects reference that gcc's GLIBCXX symbol versions. Linking libstdc++ dynamically makes the tool require those versions from the build host's libstdc++.so.6 at runtime, so it aborts with "GLIBCXX_<ver> not found" on any host whose system libstdc++ is older than the sysroot's gcc. Link the matching static libstdc++.a (already shipped in the -L dir and already a linker input via @libstdcxx_sysroot_linux_amd64//:libs) so the tool is self-contained. libclang-cpp stays dynamic and resolves its own libstdc++ needs from the host. Signed-off-by: Jonh Wendell <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> (cherry picked from commit 468dfec) Signed-off-by: Ryan Northey <[email protected]>
phlax
pushed a commit
to phlax/envoy
that referenced
this pull request
Nov 11, 2026
…#48840) The prefixer is an exec-config tool compiled against the gcc headers from envoy_toolshed's libstdcxx sysroot, so its objects reference that gcc's GLIBCXX symbol versions. Linking libstdc++ dynamically makes the tool require those versions from the build host's libstdc++.so.6 at runtime, so it aborts with "GLIBCXX_<ver> not found" on any host whose system libstdc++ is older than the sysroot's gcc. Link the matching static libstdc++.a (already shipped in the -L dir and already a linker input via @libstdcxx_sysroot_linux_amd64//:libs) so the tool is self-contained. libclang-cpp stays dynamic and resolves its own libstdc++ needs from the host. Signed-off-by: Jonh Wendell <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> (cherry picked from commit 468dfec) Signed-off-by: Ryan Northey <[email protected]>
jwendell
added a commit
that referenced
this pull request
Nov 11, 2026
The prefixer is an exec-config tool compiled against the gcc headers from envoy_toolshed's libstdcxx sysroot, so its objects reference that gcc's GLIBCXX symbol versions. Linking libstdc++ dynamically makes the tool require those versions from the build host's libstdc++.so.6 at runtime, so it aborts with "GLIBCXX_<ver> not found" on any host whose system libstdc++ is older than the sysroot's gcc. Link the matching static libstdc++.a (already shipped in the -L dir and already a linker input via @libstdcxx_sysroot_linux_amd64//:libs) so the tool is self-contained. libclang-cpp stays dynamic and resolves its own libstdc++ needs from the host. Signed-off-by: Jonh Wendell <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> (cherry picked from commit 468dfec) 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]>
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 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.
The prefixer is an exec-config tool compiled against the gcc headers from envoy_toolshed's libstdcxx sysroot, so its objects reference that gcc's GLIBCXX symbol versions. Linking libstdc++ dynamically makes the tool require those versions from the build host's libstdc++.so.6 at runtime, so it aborts with "GLIBCXX_ not found" on any host whose system libstdc++ is older than the sysroot's gcc.
Link the matching static libstdc++.a (already shipped in the -L dir and already a linker input via @libstdcxx_sysroot_linux_amd64//:libs) so the tool is self-contained. libclang-cpp stays dynamic and resolves its own libstdc++ needs from the host.