-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement static_link_cpp_runtimes feature #23204
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
The test failure is legitimate: With this setup, it is no longer possible to influence the C++ standard library choice via user link flags. In particular, the logic in place to avoid linking it into pure C targets is no longer functional. Maybe all user link libs should be gated behind this feature not being enabled? Or, perhaps better, we move the "as needed" logic into the toolchain and then filter out |
This patch implements the `static_link_cpp_runtimes` feature in `unix_cc_toolchain_config`. The feature is documented as a well-known feature[1] and was added to the toolchain[2] but not implemented. The patch adapts a solution proposed on GitHub.[3] [1] https://bazel.build/docs/cc-toolchain-config-reference#wellknown-features [2] bazelbuild#17391 [3] bazelbuild#14342
5cc2cc3
to
4e752d8
Compare
I thought of something like that when the clang tests failed. Thank you for the analysis!
I love the idea! I think it's much better. Let's see if the tests pass, now. I'm not sure what the preferred way would be for filtering out flags but I saw branching based on |
This looks good to me! Could you add a next to the one that failed previously? |
The tests won't pass because the I'm not sure how to go about it. Maybe I'm doing it wrong from the beginning. :/ |
Could we add logic to the repo rule for the toolchain that finds the C++ standard library and |
This patch implements the
static_link_cpp_runtimes
feature inunix_cc_toolchain_config
. The feature is documented as a well-known feature[1] and was added to the toolchain[2] but not implemented.The patch follows the solution proposed on GitHub.[3]
For the feature to work as expected, users have to remove the linker flag
"-lstdc++"
fromlink_libs
(orlink_flags
) from the call tounix_cc_toolchain_config
.[1] https://bazel.build/docs/cc-toolchain-config-reference#wellknown-features
[2] #17391
[3] #14342