Avoid double-linking libc++ in Bazel v8 builds

This commit is contained in:
pakrym-oai
2026-03-10 09:54:56 -07:00
parent 0435efbc2e
commit 82e2c0ba04
2 changed files with 22 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ single_version_override(
patch_strip = 1,
patches = [
"//patches:toolchains_llvm_bootstrapped_resource_dir.patch",
"//patches:toolchains_llvm_bootstrapped_linux_skip_static_runtime_libs.patch",
],
)

View File

@@ -0,0 +1,21 @@
diff --git a/runtimes/BUILD.bazel b/runtimes/BUILD.bazel
index 9db8749..a968bcc 100644
--- a/runtimes/BUILD.bazel
+++ b/runtimes/BUILD.bazel
@@ -35,11 +35,11 @@ filegroup(
filegroup(
name = "static_runtime_lib",
srcs = select({
- "@platforms//os:linux": [
- "@libcxx//:libcxx.static",
- "@libcxxabi//:libcxxabi.static",
- "@libunwind//:libunwind.static",
- ],
+ # The prebuilt rusty_v8 Linux archive already vendors the C++ runtime
+ # objects it needs. Re-linking llvm's static libc++ family in Bazel
+ # causes duplicate stdexcept symbols in Rust binaries that depend on v8.
+ # Keep the Linux runtime libgroup empty and rely on the archive instead.
+ "@platforms//os:linux": [],
"@platforms//os:windows": [
"@libcxx//:libcxx.static",
"@libcxxabi//:libcxxabi.static",