From fc8f35e4bcf878b9526d8b213f3b38e5a905918e Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Wed, 20 Aug 2025 11:12:34 +0200
Subject: [PATCH] Use libc++ only when Clang is used
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This shouldn’t change the default behavior, but makes compiling with GCC and
libstdc++ on Darwin possible.
---
cc/private/toolchain/unix_cc_configure.bzl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cc/private/toolchain/unix_cc_configure.bzl b/cc/private/toolchain/unix_cc_configure.bzl
index 6a6f38a3..0b4f2298 100644
--- a/cc/private/toolchain/unix_cc_configure.bzl
+++ b/cc/private/toolchain/unix_cc_configure.bzl
@@ -495,7 +495,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overridden_tools):
# TODO: It's unclear why these flags aren't added on macOS.
if bin_search_flags and not darwin:
force_linker_flags.extend(bin_search_flags)
- use_libcpp = darwin or bsd
+ use_libcpp = is_clang and (darwin or bsd)
is_as_needed_supported = _is_linker_option_supported(
repository_ctx,
cc,