Skip to content
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

bzlmod: hermetic_cc_toolchain>2.2.0 registers toolchains by default #181

Closed
TvdW opened this issue May 31, 2024 · 3 comments · Fixed by #190
Closed

bzlmod: hermetic_cc_toolchain>2.2.0 registers toolchains by default #181

TvdW opened this issue May 31, 2024 · 3 comments · Fixed by #190

Comments

@TvdW
Copy link

TvdW commented May 31, 2024

As of 8a1ca91 / #135, the root MODULE.bazel contains a call to register_toolchains that causes every zig-cc toolchain to be registered if the module is loaded. This means that when loading hermetic_cc_toolchain using bzlmod, it's not possible to only build a single target using this toolchain, as they will be registered by default and picked up by bazel for all compilation.

I believe this to be a bug, as the README specifically lists this as an option.

This could well be a Bazel bug in visibility: I don't think that just loading a module should ever create side-effects like this. Sadly, it still makes it problematic to load hermetic_cc_toolchain via bzlmod.

@motiejus
Copy link
Collaborator

motiejus commented Jun 6, 2024

Certainly not intended. @linzhp can you have a look?

@motiejus motiejus closed this as completed Jun 6, 2024
@motiejus motiejus reopened this Jun 6, 2024
@zaucy
Copy link

zaucy commented Jun 17, 2024

adding dev_dependency=True to the register_toolchains should prevent the toolchains from being registered by consumers of this module.

@xuzhenglun
Copy link

it seam like --incompatible_enable_cc_toolchain_resolution default to be true in bazel 7.0. I set this flag to false, and host default toolchains works again.

jvolkman added a commit that referenced this issue Jul 16, 2024
)

Mark toolchains registered in this repo as a dev dependency. Users will
need to register their own toolchains, like they do in WORKSPACE.

Fixes #181.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants