Skip to content

Commit 40ba838

Browse files
authored
Add dynamic-stdc++ (#400)
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 `dynamic-stdc++` sets the compile flags correctly but doesn't force the static version, so the sysroot's shared version will be preferred.
1 parent 8d39605 commit 40ba838

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

toolchain/cc_toolchain_config.bzl

+9
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,15 @@ def cc_toolchain_config(
268268
"-l:c++.a",
269269
"-l:c++abi.a",
270270
])
271+
elif stdlib == "dynamic-stdc++":
272+
cxx_flags = [
273+
"-std=" + cxx_standard,
274+
"-stdlib=libstdc++",
275+
]
276+
277+
link_flags.extend([
278+
"-lstdc++",
279+
])
271280
elif stdlib == "stdc++":
272281
cxx_flags = [
273282
"-std=" + cxx_standard,

0 commit comments

Comments
 (0)