-
Notifications
You must be signed in to change notification settings - Fork 446
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
Unable to load file '@bazel_version//:def.bzl': file doesn't exist #268
Comments
Which I believe stems from: rules_rust/rust/private/rustc.bzl Line 26 in fe9a91e
|
Can you paste more of your failed output here? I'm struggling to reproduce this. |
Huh, strange, I cannot reproduce it anymore myself either. May have been a transient issue. I'll post more details if I run into it again! |
I’m running into this due to a naming conflict. μpb, a dependency of the
Lines 24 to 25 in 9279938
Thus, we get “file doesn’t exist” because their repository rule runs I have a repro that’s as minimal as I can make it (removing any line WORKSPACEload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_closure",
sha256 = "6a900831c1eb8dbfc9d6879b5820fd614d4ea1db180eb5ff8aedcb75ee747c1f",
strip_prefix = "rules_closure-db4683a2a1836ac8e265804ca5fa31852395185b",
urls = [
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/db4683a2a1836ac8e265804ca5fa31852395185b.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/db4683a2a1836ac8e265804ca5fa31852395185b.tar.gz", # 2020-01-15
],
)
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies")
rules_closure_dependencies(
omit_bazel_skylib = True,
omit_com_google_protobuf = True,
omit_com_google_protobuf_js = True,
)
http_archive(
name = "org_tensorflow",
# NOTE: when updating this, MAKE SURE to also update the protobuf_js runtime version
# in third_party/workspace.bzl to >= the protobuf/protoc version provided by TF.
sha256 = "2595a5c401521f20a2734c4e5d54120996f8391f00bb62a57267d930bce95350",
strip_prefix = "tensorflow-2.3.0",
urls = [
"http://mirror.tensorflow.org/github.com/tensorflow/tensorflow/archive/v2.3.0.tar.gz", # 2020-07-23
"https://github.com/tensorflow/tensorflow/archive/v2.3.0.tar.gz",
],
)
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace()
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
load("@upb//bazel:repository_defs.bzl", "bazel_version_repository")
# This next line breaks the build, but without it we can't build protos.
bazel_version_repository(name = "bazel_version")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_rust",
sha256 = "618cba29165b7a893960de7bc48510b0fb182b21a4286e1d3dbacfef89ace906",
strip_prefix = "rules_rust-5998baf9016eca24fafbad60e15f4125dd1c5f46",
urls = [
# Master branch as of 2020-09-24
"https://github.com/bazelbuild/rules_rust/archive/5998baf9016eca24fafbad60e15f4125dd1c5f46.tar.gz",
],
)
load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
rust_repositories()
load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace")
rust_workspace() BUILDload("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test")
package(default_visibility = ["//visibility:private"])
licenses(["notice"])
rust_library(
name = "mylib",
srcs = [
"lib.rs",
],
) .bazelrccommon --experimental_repo_remote_exec lib.rsEmpty file. Command line session$ grep -B1 name BUILD
rust_library(
name = "mylib",
$ bazel build :mylib
ERROR: Skipping ':mylib': error loading package '': in /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/io_bazel_rules_rust/rust/rust.bzl: in /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/io_bazel_rules_rust/rust/private/rustdoc_test.bzl: in /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/io_bazel_rules_rust/rust/private/rustc.bzl: Unable to load file '@bazel_version//:def.bzl': file doesn't exist
WARNING: Target pattern parsing failed.
ERROR: error loading package '': in /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/io_bazel_rules_rust/rust/rust.bzl: in /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/io_bazel_rules_rust/rust/private/rustdoc_test.bzl: in /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/io_bazel_rules_rust/rust/private/rustc.bzl: Unable to load file '@bazel_version//:def.bzl': file doesn't exist
INFO: Elapsed time: 0.080s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
$ ls /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/bazel_version
bazel_version.bzl BUILD WORKSPACE
$ cat /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/bazel_version/bazel_version.bzlbazel_version = "2.1.0"$
$ cat /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/bazel_version/bazel_version.bzl; echo
bazel_version = "2.1.0"
$ sed -i -e '/bazel_version_repository/ s/^/#/' WORKSPACE
$ bazel build :mylib
INFO: Analyzed target //:mylib (26 packages loaded, 186 targets configured).
INFO: Found 1 target...
Target //:mylib up-to-date:
bazel-bin/libmylib--1103081910.rlib
INFO: Elapsed time: 1.100s, Critical Path: 0.67s
INFO: 5 processes: 5 linux-sandbox.
INFO: Build completed successfully, 9 total actions
$ ls /HOMEDIR/.cache/bazel/_bazel_wchargin/bf4ce76fb2a3b9593d6023d4a99e07e4/external/bazel_version
BUILD def.bzl WORKSPACE Bazel version: It looks like diff --git a/docs/BUILD b/docs/BUILD
index 19bb042..cc7002f 100644
--- a/docs/BUILD
+++ b/docs/BUILD
@@ -7,7 +7,7 @@ bzl_library(
name = "all_deps",
srcs = [
"@bazel_tools//tools:bzl_srcs",
- "@bazel_version//:def.bzl",
+ "@io_bazel_rules_rust_bazel_version//:def.bzl",
],
deps = [
"@bazel_skylib//lib:versions",
diff --git a/rust/private/rustc.bzl b/rust/private/rustc.bzl
index c3d5f9b..ea84b2e 100644
--- a/rust/private/rustc.bzl
+++ b/rust/private/rustc.bzl
@@ -23,7 +23,7 @@ load(
"find_cpp_toolchain",
)
load("@bazel_skylib//lib:versions.bzl", "versions")
-load("@bazel_version//:def.bzl", "BAZEL_VERSION")
+load("@io_bazel_rules_rust_bazel_version//:def.bzl", "BAZEL_VERSION")
CrateInfo = provider(
fields = {
diff --git a/workspace.bzl b/workspace.bzl
index d54ac1e..fe14180 100644
--- a/workspace.bzl
+++ b/workspace.bzl
@@ -29,5 +29,5 @@ def rust_workspace():
bazel_skylib_workspace()
- bazel_version(name = "bazel_version")
+ bazel_version(name = "io_bazel_rules_rust_bazel_version")
This patch seems to solve the problem for me, so I’ll submit a PR. |
We use a synthetic `bazel_version` repository to make the Bazel version available in more contexts (see [bazelbuild/bazel#8305][i8305]). But some other repositories do so, too, with the same repository name and a different repository structure. In particular, it is not currently possible to use `rules_rust` and certain versions of `upb` (downstream of protobuf) in the same repository, due to their definition here: https://github.com/protocolbuffers/upb/blob/c1357afb2e39df671d89eaec49033b5329f36a3e/bazel/repository_defs.bzl#L7-L10 An easy workaround is to disambiguate the name. It looks much easier to change `rules_rust` than to change `upb` and update its long chain of workspace dependencies, hence this patch. :-) See my comment on bazelbuild#268 for more details and a full repro: bazelbuild#268 (comment) [i8305]: bazelbuild/bazel#8305 Test Plan: Tested by adding the README’s workspace stanza to TensorBoard (at current master, 8d629954c251). It fails at `rules_rust = 5998baf`, but succeeds with a `local_repository` that has this patch. wchargin-branch: disambiguate-bazel-version-repo wchargin-source: 7d8ca1dd816cca59f4e1099257e6bd3a77475368
We use a synthetic `bazel_version` repository to make the Bazel version available in more contexts (see [bazelbuild/bazel#8305][i8305]). But some other repositories do so, too, with the same repository name and a different repository structure. In particular, it is not currently possible to use `rules_rust` and certain versions of `upb` (downstream of protobuf) in the same repository, due to their definition here: https://github.com/protocolbuffers/upb/blob/c1357afb2e39df671d89eaec49033b5329f36a3e/bazel/repository_defs.bzl#L7-L10 An easy workaround is to disambiguate the name. It looks much easier to change `rules_rust` than to change `upb` and update its long chain of workspace dependencies, hence this patch. :-) See my comment on bazelbuild#268 for more details and a full repro: bazelbuild#268 (comment) [i8305]: bazelbuild/bazel#8305 Test Plan: Tested by adding the README’s workspace stanza to TensorBoard (at current master, 8d629954c251). It fails at `rules_rust = 5998baf`, but succeeds with a `local_repository` that has this patch. Also, in this repo, `git grep @bazel_version` no longer has any matches. wchargin-branch: disambiguate-bazel-version-repo wchargin-source: e712603c3a3ebc45364cc2dcc9eca341301b5197
We use a synthetic `bazel_version` repository to make the Bazel version available in more contexts (see [bazelbuild/bazel#8305][i8305]). But some other repositories do so, too, with the same repository name and a different repository structure. In particular, it is not currently possible to use `rules_rust` and certain versions of `upb` (downstream of protobuf) in the same repository, due to their definition here: https://github.com/protocolbuffers/upb/blob/c1357afb2e39df671d89eaec49033b5329f36a3e/bazel/repository_defs.bzl#L7-L10 An easy workaround is to disambiguate the name. It looks much easier to change `rules_rust` than to change `upb` and update its long chain of workspace dependencies, hence this patch. :-) See my comment on #268 for more details and a full repro: #268 (comment) [i8305]: bazelbuild/bazel#8305 Test Plan: Tested by adding the README’s workspace stanza to TensorBoard (at current master, 8d629954c251). It fails at `rules_rust = 5998baf`, but succeeds with a `local_repository` that has this patch. Also, in this repo, `git grep @bazel_version` no longer has any matches. wchargin-branch: disambiguate-bazel-version-repo wchargin-source: e712603c3a3ebc45364cc2dcc9eca341301b5197
With this
WORKSPACE
:And bazel version 1.1.0,
bazel fetch
fails withThe crux of this appears to be
The text was updated successfully, but these errors were encountered: