Skip to content

Commit

Permalink
Add dynamic-stdc++ (#400)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
keith authored Dec 20, 2024
1 parent 8d39605 commit 40ba838
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions toolchain/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,15 @@ def cc_toolchain_config(
"-l:c++.a",
"-l:c++abi.a",
])
elif stdlib == "dynamic-stdc++":
cxx_flags = [
"-std=" + cxx_standard,
"-stdlib=libstdc++",
]

link_flags.extend([
"-lstdc++",
])
elif stdlib == "stdc++":
cxx_flags = [
"-std=" + cxx_standard,
Expand Down

0 comments on commit 40ba838

Please sign in to comment.