Skip to content

Use Bazel-provided auto-configured toolchains#163

Closed
fmeum wants to merge 2 commits intobazelbuild:mainfrom
fmeum:remove-toolchains
Closed

Use Bazel-provided auto-configured toolchains#163
fmeum wants to merge 2 commits intobazelbuild:mainfrom
fmeum:remove-toolchains

Conversation

@fmeum
Copy link
Copy Markdown
Collaborator

@fmeum fmeum commented Jan 9, 2023

The auto-configured toolchains provided by Bazel itself have diverged heavily from the version maintained in this repo. There is no need to maintain this duplication until Starlarkification has progressed succiciently for rules_cc to be the source of truth for them.

This is particularly relevant for Bzlmod, which currently uses the toolchains defined in rules_cc. As a result, Bazel C++ builds will use subtly different toolchains depending on whether --enable_bzlmod is used or not. This is fixed by loading toolchain detection logic from @bazel_tools in the module extension.

The auto-configured toolchains provided by Bazel itself have diverged
heavily from the version maintained in this repo. There is no need to
maintain this duplication until Starlarkification has progressed
succiciently for rules_cc to be the source of truth for them.

This is particularly relevant for Bzlmod, which currently uses the
toolchains defined in rules_cc. As a result, Bazel C++ builds will use
subtly different toolchains depending on whether `--enable_bzlmod` is
used or not. This is fixed by loading toolchain detection logic from
`@bazel_tools` in the module extension.
@fmeum fmeum marked this pull request as ready for review January 9, 2023 13:12
@phst
Copy link
Copy Markdown
Contributor

phst commented Dec 4, 2024

This got rolled back in bc665f9

@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Dec 4, 2024

It got rolled back, but in the meantime Bazel's toolchain has finally been moved to rules_cc (in Bazel 8).

The linked issue could be fixed in rules_cc, but the non-apple_support toolchain for macOS is not actively maintained.

@phst
Copy link
Copy Markdown
Contributor

phst commented Dec 4, 2024

Good point, thanks. Commit c2549f6 has added a recent copy of the toolchain configuration code; maybe cc_toolchain_config.bzl is unused now and can be deleted entirely?

@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Dec 4, 2024

Which file are you referring to? That one doesn't exist in the Bazel repo at HEAD.

@phst
Copy link
Copy Markdown
Contributor

phst commented Dec 4, 2024

Sorry, I mean https://github.com/bazelbuild/rules_cc/blob/main/cc/private/toolchain/cc_toolchain_config.bzl. That one still has -undefined dynamic_lookup, but seems unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants