From 82e2c0ba04504e46dcbcee027cd38ca0c90324aa Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Tue, 10 Mar 2026 09:54:56 -0700 Subject: [PATCH] Avoid double-linking libc++ in Bazel v8 builds --- MODULE.bazel | 1 + ...apped_linux_skip_static_runtime_libs.patch | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 patches/toolchains_llvm_bootstrapped_linux_skip_static_runtime_libs.patch diff --git a/MODULE.bazel b/MODULE.bazel index c4bcd33e22..950549f2d0 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -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", ], ) diff --git a/patches/toolchains_llvm_bootstrapped_linux_skip_static_runtime_libs.patch b/patches/toolchains_llvm_bootstrapped_linux_skip_static_runtime_libs.patch new file mode 100644 index 0000000000..d3d5a0fb4c --- /dev/null +++ b/patches/toolchains_llvm_bootstrapped_linux_skip_static_runtime_libs.patch @@ -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",