You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works with bazel 7, but when I try update bazel to 8, I'm starting to get:
$ bazel build //path/to/foo:bin
ERROR: no such package '@@[unknown repo 'platforms' requested from @@]//cpu': The repository '@@[unknown repo 'platforms' requested from @@]' could not be resolved: No repository visible as '@platforms' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration
ERROR: /path/to/top/BUILD.bazel:10:9: no such package '@@[unknown repo 'platforms' requested from @@]//cpu': The repository '@@[unknown repo 'platforms' requested from @@]' could not be resolved: No repository visible as '@platforms' from main repository. Was the repository introduced in WORKSPACE? The WORKSPACE file is disabled by default in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025), please migrate to Bzlmod. See https://bazel.build/external/migration and referenced by '//:amd64_v1'
ERROR: /path/to/top/path/to/foo/BUILD.bazel:115:16: Target //:linux_amd64 was referenced as a platform, but does not provide PlatformInfo
ERROR: Analysis of target '//path/to/foo:bin' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.356s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
I tried to look up the bazel docs regarding platforms for 8 and they doesn't seem changed from 7, so I'm not sure whether this is an issue with rules_go or something with bazel 8. I currently don't have any bzlmod dependency to platform or @platforms, not sure if that's migrated to a bzlmod (I found https://registry.bazel.build/modules/rules_platform & https://registry.bazel.build/modules/platforms on BCR but neither look like the provider of @platforms to me).
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered:
unknown repo 'platforms' requested from @@ means that the main repository doesn't see any repo under the name platforms. Since Bazel 8 disabled WORKSPACE by default, you either need to pass --enable_workspace or add a bazel_dep on the platforms module.
oh so this is bazel_dep(name = "platforms", version = "0.0.10") in MODULE.bazel, in bazel 7 it's from indirect dependency (likely via rules_go) and that's enough, but in bazel 8 it must be declared as direct dependency to work.
platforms is treated specially when WORKSPACE is enabled purely for backwards compatibility, you generally have to declare all repos as direct deps that you reference.
What version of rules_go are you using?
0.50.1
What version of gazelle are you using?
0.40.0
What version of Bazel are you using?
8.0.0
Does this issue reproduce with the latest releases of all the above?
Those are latest releases
What operating system and processor architecture are you using?
linux/amd64
Any other potentially useful information about your toolchain?
What did you do?
From the discussion of #4131, we are using the following to do cross build for container image:
BUILD.bazel
:This works with bazel 7, but when I try update bazel to 8, I'm starting to get:
I tried to look up the bazel docs regarding platforms for 8 and they doesn't seem changed from 7, so I'm not sure whether this is an issue with rules_go or something with bazel 8. I currently don't have any bzlmod dependency to
platform
or@platforms
, not sure if that's migrated to a bzlmod (I found https://registry.bazel.build/modules/rules_platform & https://registry.bazel.build/modules/platforms on BCR but neither look like the provider of@platforms
to me).What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: