Skip to content

Commit

Permalink
Add system-stdc++ for shared libstdc++ linking
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 `system-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 committed Oct 11, 2024
1 parent c6c4eb5 commit e99de56
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions toolchain/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ def cc_toolchain_config(
"-l:c++.a",
"-l:c++abi.a",
])
elif stdlib == "system-stdc++":
cxx_flags = [
"-std=" + cxx_standard,
"-stdlib=libstdc++",
]
elif stdlib == "stdc++":
cxx_flags = [
"-std=" + cxx_standard,
Expand Down

0 comments on commit e99de56

Please sign in to comment.