Removing the default macOS toolchain from rules_cc
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- cpp
- Domain
- build-system
Research direction
Start by reading cc/private/toolchain/unix_cc_toolchain_config.bzl in rules_cc and the linked apple_support crosstool/cc_toolchain_config.bzl, then review the MODULE.bazel dependency ordering described in the issue. The work is complete only after the legacy macOS toolchain is removed without breaking supported macOS users, with compatibility issues from the listed migration cases addressed.
Written by the indexing model from the issue text.
Description
Overview
Currently for historical reasons there are 2 toolchains on the bazelbuild org that can target macOS. One in apple_support (that also supports iOS and other Apple platforms), and the one in rules_cc that is roughly shared with the default linux toolchain (roughly because many things differ between the 2 platforms).
Before this toolchain was moved out of the bazel repo and into rules_cc, it was not feasible to remove it. Now that both exist in separate repos, and both of these repos are depended on by bazel by default, we are planning to remove the duplicated rules_cc version of this toolchain, and require users to use the toolchain from apple_support moving forward.
Why
There are a few reasons for this:
- the toolchain in
rules_ccisn't hermetic because of complexities with Apple's tools, this has been solved inapple_support, and to solve it here would just require duplicating the same implementation - this reduces confusion from users because both toolchains are always registered, and always conflict, so which toolchain you actually get depends on the order of
bazel_deptargets in yourMODULE.bazel - this reduces maintenance overhead for the maintainers
- Previously the
apple_supporttoolchain did not support the Xcode Command Line Tools only (meaning it required a full Xcode install) but this is no longer the case
Plan
- Merge an off by default environment variable to disable the
rules_cctoolchain for early testing with--repo_env=BAZEL_USE_LEGACY_MACOS_TOOLCHAIN=0, release it ASAP (hopefully 0.2.20) - Flip the default, while still allowing users to bring the old toolchain back with
--repo_env=BAZEL_USE_LEGACY_MACOS_TOOLCHAIN=1, release it 1 release later (hopefully 0.2.21) - Field issues that come up from subtleties for a few months
- Fully delete the
rules_cctoolchain, probably after bazel 10.x releases depending on the number of issues that come up
Known changes
- The
apple_supporttoolchain has slightly different arguments / ordering of arguments thanrules_ccthat will not be aligned and likely won't cause issues but could, we'll have to field these case by case - Projects can be calling
configure_unix_toolchainmanually with their own tools and expect the resulting toolchain to work with macOS. It's possible we could expand theapple_supporttoolchain to support similar behavior, but this will be considered case by case toolchains_llvmdoes the above, we will have to decide how to handle that repoapple_supportonly supports compilers shipped with Apple's tools, not thebrewinstall ofclangorgcc, support for this is possible some please comment if this is something that is desired (although possibly a better recommendation would be to move to one of the fully hermetic toolchains instead)
Other notes
- If you're using bazel 7.x or earlier, even if you update
rules_ccthis likely doesn't apply since this toolchain still lived in bazel at the time. This would apply to 8.x+ apple_supportdoesn't support WORKSPACE anymore, but it could again if needed. The last version with workspace support was 1.24.5 which could likely also be used instead
Feedback
Please comment here, or file issues on apple_support with any issues you see with this plan, or incompatibilities you hit with this change.
If you would like to test this today you can add apple_support to your MODULE.bazel above rules_cc like:
bazel_dep(name = "apple_support", version = "2.6.1")
bazel_dep(name = "rules_cc", version = "0.2.19")
- Dominant language
- Starlark
- Stars
- 247
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_cc
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bazelbuild/rules_cc#841 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bazelbuild/rules_cc#839 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
bazelbuild/rules_cc#895 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
bazelbuild/rules_cc#893 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bazelbuild/rules_cc#847 ·
All issues in bazelbuild/rules_cc
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
oSoWoSo/vOid_Community_repOsitory#147 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
agentic-workflows cascade-suspected
Difficulty 1/5 Under an hour Newbie friendliness 88/100