-
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
Platform/toolchain support for C++ rules #6516
Comments
Before I leave for 3 weeks of vacation, let me say I'm not aware of any work needed now that 683c302 is submitted. John, do you know about anything? |
Testing, that's all. Enjoy your vacation! |
I'm back! :) Could you give me a list of behaviors/features that I should test? I don't know where to start :) |
The big areas we've had problems with were around finding the correct CROSSTOOL file for a cc_toolchain. @nlopezgi might have more ideas, but honestly I'd just start taking any cc rules integration tests, and try running them with toolchain resolution enabled for cc toolchains, to see what happens. |
I'd like to see tests that run with custom values for some of the ENV variables that cc_config uses. Most of the times we have seen issues is because we set custom values for some of these ENV variables in our rules (https://github.com/bazelbuild/bazel-toolchains/blob/master/rules/environments.bzl#L30). |
This is a bigger ask: I would like to see changes that impact crosstool/c_toolchain compatibility to be guarded behind --incompatible flags. Let me expand that: Currently, when there are changes to the CROSSTOOL / c_toolchain, there is no guarding them behind an --incopatible flag (afaik). For users that have hand built or checked in versions of a CROSSTOOL / c_toolchain, they have no way of preventing Bazel changes in release X+1 from breaking them. |
The other problem I had in the past is that adding the |
Hi Nick!
Thanks for chiming in! |
Also, this issue is specifically for "cc rules work when --enabled_toolchain_types=@bazel_tools//tools/cpp:toolchain_type is passed". Other cc rules issues should be filed separately. |
@gregestren could you add a priority to this issue, please? |
See #7260 |
Please do not assign issues to more than one team |
Previously, we accessed that information from TransitiveInfoCollection, but when we migrate to platforms/toolchains we only have access to the toolchain provider. This cl adds a field on the `CcToolchainInfo` so we can migrate C++ rules to platforms/toolchains. #6516 RELNOTES: None. PiperOrigin-RevId: 236351968
Update: a major reason this hasn't been toggled on yet is it'll break Android or iOS projects with C++ native deps. Configurability devs are doing a concerted focus now on adding platform/toolchain support for Android builds to unblock. We may be getting support for doing the same for iOS builds too, although I'm unclear on how much yet. |
Changing team to reflect who's been doing the work. |
Downgrading priority to reflect the current level of activity. |
…ime_lib to Starlark This is required since existing cc_toolchain.all_files doesn't usually contain C++ runtime library. Progress towards bazelbuild/bazel#6516 RELNOTES: `cc_toolchain.static_runtime_lib` and `cc_toolchain.dynamic_runtime_lib` are now exposed to Starlark. PiperOrigin-RevId: 242863875
bazelbuild/bazel#6516 RELNOTES: None. PiperOrigin-RevId: 241523004
With this cl we will pass target libc to the host configuration and analyze it from cc_toolchain attribute. This is needed to migrate C++ rules to platforms, under which cc_toolchain is analyzed in the host configuration. bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 241043559
This way, we can compute build variables for a different configuration than the one present at cc_toolchain analysis. Do bad things in the process (such as storing BuildOptions in FeatureConfigurationForStarlark or creating AppleConfiguration inline in the AdditionalBuildVariableComputer). bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240997356
This is a preparation for moving variables away from toolchains to rules (because toolchains don't get analyzed in the same configuration as rules). bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240759048
…target configuration This is there to allow cc_toolchain to detect that FDO is active, and to preprocess profiles, while being analyzed in the host configuration. FDO related options are passed to the host configuration, they are preprocessed in the host configuration, but then used in the target configuration. Extra care is made to not enable FDO in the host configuration (as this is the existing behavior). bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240721577
Fdo related logic is complicated enough to have it in a separate class. bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240376113
This is unfortunate, confusing for the user, and less accurate than what the original behavior was, but because cc_toolchain cannot access (currently, with platforms enabled) the target configuration, there is nothing we can do other than showing the error for the target. bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240345500
This falls nicely into our quest to not use configuration from cc_toolchain :) bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240338037
Instead, compute it for each target separately using its rule context. bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240330179
Instead read it from the CppConfiguration passed from the target. bazelbuild/bazel#6516 RELNOTES: None PiperOrigin-RevId: 240317365
In order to migrate C++ rules to platforms, we need the access to the C++ configuration fragment from the caller rule in Starlark APIs. All existing APIs have already access to it, but cc_common.configure_features doesn't. This incompatible change adds a ctx argument to configure_features. bazelbuild/bazel#7793 bazelbuild/bazel#6516 RELNOTES: Added `--incompatible_require_ctx_in_configure_features`, see bazelbuild/bazel#7793 for details. PiperOrigin-RevId: 240099411
Benefits: - More efficient caching for exec actions (which shouldn't integrate FDO data) - simpler, more straightforward code - resolves outdated logic from before toolchain transitions (https://github.com/bazelbuild/proposals/blob/main/designs/2020-02-07-toolchain-transition-migration.md) #6516 PiperOrigin-RevId: 478011721 Change-Id: I8df049eeb78003fa9e979a91313e45cb9de95d01
Benefits: - More efficient caching for exec actions (which shouldn't integrate FDO data) - simpler, more straightforward code - resolves outdated logic from before toolchain transitions (https://github.com/bazelbuild/proposals/blob/main/designs/2020-02-07-toolchain-transition-migration.md) bazelbuild#6516 PiperOrigin-RevId: 478011721 Change-Id: I8df049eeb78003fa9e979a91313e45cb9de95d01
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 2+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
In order to migrate C++ rules to platforms, we need the access to the C++ configuration fragment in Starlark APIs. All existing APIs have already access to it, but cc_common.configure_features doesn't. This change adds a ctx argument to configure_features. This is the migration needed for bazelbuild/bazel#7793, and is part of the effort for bazelbuild/bazel#6516. If the rule doesn't depend on cpp fragment yet, you will have to add `fragments =['cpp']` argument to the rule() call. Note that this behavior is only available in Bazel 0.25 (to be released this month). RELNOTES: None. PiperOrigin-RevId: 247206987
In order to migrate C++ rules to platforms, we need the access to the C++ configuration fragment in Starlark APIs. All existing APIs have already access to it, but cc_common.configure_features doesn't. This change adds a ctx argument to configure_features. This is the migration needed for bazelbuild/bazel#7793, and is part of the effort for bazelbuild/bazel#6516. If the rule doesn't depend on cpp fragment yet, you will have to add `fragments =['cpp']` argument to the rule() call. Note that this behavior is only available in Bazel 0.25 (to be released this month). RELNOTES: None. PiperOrigin-RevId: 248534309
Tracking issue on Bazel Configurability Roadmap
Goal:
The text was updated successfully, but these errors were encountered: