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

[Bazel CI]cc_configure.bzl does not export a module extension called cc_configure_extension. #1135

Open
sgowroji opened this issue Oct 15, 2024 · 1 comment

Comments

@sgowroji
Copy link

CI: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4200#01928e5d-1434-461c-a9de-dd55737653e3

Platform: Windows

Logs:

(04:10:21) WARNING: Couldn't auto load rules or symbols, because no dependency on module/repository 'rules_android' found. This will result in a failure if there's a reference to those rules or symbols.
Target //:shared_headers failed to build
(04:10:25) ERROR: Analysis of target '//bazel/example:main' failed; build aborted: @@bazel_tools//tools/cpp:cc_configure.bzl does not export a module extension called cc_configure_extension, yet its use is requested at C:/b/bk-windows-5k1s/bazel-org-repo-root/glog/MODULE.bazel:11:29
(04:10:25) INFO: Elapsed time: 4.544s, Critical Path: 0.05s
(04:10:25) INFO: 1 process: 1 internal.
(04:10:25) ERROR: Build did NOT complete successfully
(04:10:25) FAILED:

Culprit: bazelbuild/bazel@1c4e78a

Steps:

git clone https://github.com/google/glog
git reset de309c08c05382fee0792380de7df1bd65332da2  --hard
export USE_BAZEL_VERSION=18e3dc07876536b98d93aca1997478700b9c8d9e
bazel build --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:x64_windows-clang-cl --compiler=clang-cl --features=layering_check //... 

CC Greenteam @meteorcloudy

drigz added a commit that referenced this issue Oct 16, 2024
See #1135. Not sure if this will work because the error only repros on
Windows with a specific Bazel version.
drigz added a commit that referenced this issue Oct 16, 2024
See #1135. Not sure if this will work because the error only repros on
Windows with a specific Bazel version.
@drigz
Copy link
Member

drigz commented Oct 16, 2024

Thanks for the report! Esp thanks for the repro steps with USE_BAZEL_VERSION, super helpful.

I found the migration guide linked from the culprit a lacking here. It just says "If you are depending on anything in @bazel_tools//tools/cpp, you should use the version from @rules_cc instead." - IIUC this dependency came from the PR that migrated glog to bzlmod, but I figured I'd take a shot at migrating it.

  1. Try s/bazel_tools/rules_cc/ which failed with: no repo visible as '@rules_cc' here
  2. Copy bazel_dep(name = "rules_cc", version = "0.0.12") from bazelbuild/bazel@1c4e78a, fails with no such package '@@rules_cc+//tools/cpp'
  3. Copy "@rules_cc//cc/private/toolchain:clang-cl" and "@rules_cc//cc:extensions.bzl" from the above commit, fails with ERROR: /usr/local/google/home/rodrigoq/git/glog/BUILD.bazel:7:13: While resolving toolchains for target //:strip_include_prefix_hack (77ef3ef): invalid registered toolchain '@local_config_cc//:cc-toolchain-x64_windows-clang-cl': no such target '@@rules_cc++cc_configure_extension+local_config_cc//:cc-toolchain-x64_windows-clang-cl': target 'cc-toolchain-x64_windows-clang-cl' not declared in package '' defined by /usr/local/google/home/rodrigoq/.cache/bazel/_bazel_rodrigoq/dd880f2ce084c0dadd188a0a46eacfcd/external/rules_cc++cc_configure_extension+local_config_cc/BUILD.
  4. Realize this is because the repro instructions are for a Windows build and I'm on a Linux dev machine, maybe this will work in CI, but the repro instructions only work for local execution...

Created #1136 and hoping I'm on the right track given that I don't have a way to actually test the fix.

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

No branches or pull requests

2 participants