Skip to content

Commit e99de56

Browse files
committed
Add system-stdc++ for shared libstdc++ linking
Depending on your project statically linking libstdc++ from your sysroot might not be viable. For example if you rely on other shared libraries that link the shared version, linking the static version to a binary might result in ODR violations. This new `system-stdc++` sets the compile flags correctly but doesn't force the static version, so the sysroot's shared version will be preferred.
1 parent c6c4eb5 commit e99de56

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

toolchain/cc_toolchain_config.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ def cc_toolchain_config(
244244
"-l:c++.a",
245245
"-l:c++abi.a",
246246
])
247+
elif stdlib == "system-stdc++":
248+
cxx_flags = [
249+
"-std=" + cxx_standard,
250+
"-stdlib=libstdc++",
251+
]
247252
elif stdlib == "stdc++":
248253
cxx_flags = [
249254
"-std=" + cxx_standard,

0 commit comments

Comments
 (0)