From 7622ea39243526e3e85caf452cfb6f34617dd78e Mon Sep 17 00:00:00 2001 From: Malte Poll <1780588+malt3@users.noreply.github.com> Date: Wed, 14 May 2025 17:39:20 +0200 Subject: [PATCH] toolchain config: use "-l:libc++.a" and "-l:libc++abi.a" in sysroot When cross compiling with a sysroot, the toolchain defaults to libstdc++. However, if a user specifically select libc++ like so: ``` stdlib = { "linux-aarch64": "libc++", "linux-x86_64": "libc++", }, ``` ... we emit invalid linker flags. For all sysroots I could find, the name of the archive is "libc++.a" and "libc++abi.a", not "c++.a". --- toolchain/cc_toolchain_config.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/cc_toolchain_config.bzl b/toolchain/cc_toolchain_config.bzl index 3a66da7bd..7dd7fc166 100644 --- a/toolchain/cc_toolchain_config.bzl +++ b/toolchain/cc_toolchain_config.bzl @@ -289,8 +289,8 @@ def cc_toolchain_config( ] link_flags.extend([ - "-l:c++.a", - "-l:c++abi.a", + "-l:libc++.a", + "-l:libc++abi.a", ]) elif stdlib == "dynamic-stdc++": cxx_flags = [