question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bazel] Build error from source

See original GitHub issue

What is the problem?

Have the following build error when building from source using bazel 4.0.

DEBUG: /home/acxz/vcs/git/github/acxz/pkgbuilds/python-ray/src/ray-ray-1.2.0/bazel/ray_deps_setup.bzl:63:14: No implicit mirrors used because urls were explicitly provided
ERROR: /home/acxz/.cache/bazel/_bazel_acxz/efe9f06255fafeaf8887ca9ca2d64c2e/external/com_google_protobuf/BUILD:873:21: in proto_lang_toolchain rule @com_google_protobuf//:cc_toolchain: '@com_google_protobuf//:cc_toolchain' does not have mandatory provider 'ProtoInfo'.
INFO: Repository boost instantiated at:
  /home/acxz/vcs/git/github/acxz/pkgbuilds/python-ray/src/ray-ray-1.2.0/WORKSPACE:5:15: in <toplevel>
  /home/acxz/vcs/git/github/acxz/pkgbuilds/python-ray/src/ray-ray-1.2.0/bazel/ray_deps_setup.bzl:134:22: in ray_deps_setup
  /home/acxz/vcs/git/github/acxz/pkgbuilds/python-ray/src/ray-ray-1.2.0/bazel/ray_deps_setup.bzl:74:24: in auto_http_archive
Repository rule http_archive defined at:
  /home/acxz/.cache/bazel/_bazel_acxz/efe9f06255fafeaf8887ca9ca2d64c2e/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: Analysis of target '//:ray_pkg' failed; build aborted: Analysis of target '@com_google_protobuf//:cc_toolchain' failed
INFO: Elapsed time: 1.303s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (7 packages loaded, 247 targets configured)
    Fetching @cython; Restarting.

Ray version and other system information (Python version, TensorFlow version, OS): Bazel: 4.0

Reproduction (REQUIRED)

N/A Please provide a short code snippet (less than 50 lines if possible) that can be copy-pasted to reproduce the issue. The snippet should have no external library dependencies (i.e., use fake or mock data / environments):

If the code snippet cannot be run by itself, the issue will be closed with “needs-repro-script”.

  • I have verified my script runs in a clean environment and reproduces the issue.
  • I have verified the issue also occurs with the latest wheels.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Vigilanscommented, Mar 17, 2021

From https://github.com/bazelbuild/bazel/issues/12887#issuecomment-765950727 and https://github.com/bazelbuild/bazel/issues/12887#issuecomment-768894825, update protobuf to latest version also works (built with @acxz 's py39 branch merged):

diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl
index fcef5edee..df099a67a 100644
--- a/bazel/ray_deps_setup.bzl
+++ b/bazel/ray_deps_setup.bzl
@@ -243,6 +243,12 @@ def ray_deps_setup():
         sha256 = "781fa39693ec2984c71213cd633e9f6589eaaed75e3a9ac413237edec96fd3b9",
     )
 
+    http_archive(
+        name = "com_google_protobuf",
+        strip_prefix = "protobuf-3.15.6",
+        urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.15.6.tar.gz"],
+    )
+
     auto_http_archive(
         name = "rules_proto_grpc",
         url = "https://github.com/rules-proto-grpc/rules_proto_grpc/archive/a74fef39c5fe636580083545f76d1eab74f6450d.tar.gz",
1reaction
paulfryzelcommented, Mar 10, 2021

From https://github.com/bazelbuild/bazel/issues/12887#issuecomment-765950727:

diff --git a/bazel/ray_deps_build_all.bzl b/bazel/ray_deps_build_all.bzl
index a81480664..5cc79aec7 100644
--- a/bazel/ray_deps_build_all.bzl
+++ b/bazel/ray_deps_build_all.bzl
@@ -6,6 +6,7 @@ load("@com_github_jupp0r_prometheus_cpp//bazel:repositories.bzl", "prometheus_cp
 load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure")
 load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
 load("@rules_proto_grpc//:repositories.bzl", "rules_proto_grpc_toolchains")
+load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
 
 
 def ray_deps_build_all():
@@ -17,3 +18,5 @@ def ray_deps_build_all():
   python_configure(name = "local_config_python")
   grpc_deps()
   rules_proto_grpc_toolchains()
+  rules_proto_dependencies()
+  rules_proto_toolchains()
\ No newline at end of file
diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl
index c398dd15d..20b6bbda5 100644
--- a/bazel/ray_deps_setup.bzl
+++ b/bazel/ray_deps_setup.bzl
@@ -265,3 +265,10 @@ def ray_deps_setup():
         urls = ["https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz"],
         sha256 = "b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0",
     )
+
+    auto_http_archive(
+        name = "rules_proto",
+        sha256 = "d8992e6eeec276d49f1d4e63cfa05bbed6d4a26cfe6ca63c972827a0d141ea3b",
+        strip_prefix = "rules_proto-cfdc2fa31879c0aebe31ce7702b1a9c8a4be02d2",
+        url = "https://github.com/bazelbuild/rules_proto/archive/cfdc2fa31879c0aebe31ce7702b1a9c8a4be02d2.tar.gz",
+    )
\ No newline at end of file
diff --git a/python/setup.py b/python/setup.py
index 62c516e9c..b46d9749c 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
 # manually.
 
 SUPPORTED_PYTHONS = [(3, 6), (3, 7), (3, 8)]
-SUPPORTED_BAZEL = (3, 2, 0)
+SUPPORTED_BAZEL = (4, 0, 0)
 
 ROOT_DIR = os.path.dirname(__file__)
 BUILD_JAVA = os.getenv("RAY_INSTALL_JAVA") == "1"

… should do it. Verified working build+tests w/ bazel 4.0.0 on macOS 11.2.2, ray at ea7d4c66076c5141bbf22c60d77ff4868b1cbb87.

@rkooo567 Is this something you’d be open to a PR on?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiling Bazel from Source
Step 1: Get the latest Bazel release · Maybe your Bazel binary's directory is not on the PATH. This is not a big...
Read more >
Building Gerrit from source using Bazel. Error at the verry first ...
I wanted to have a closer look, so I said "let's compile Gerrit first from source". Oh, that needs Bazel, fine. For the...
Read more >
Build error in Bazel - Google Groups
Maybe the error might be that you are using an incorrect version of Bazel. Try using Bazelisk :).
Read more >
How to ensure your code builds with Bazel - CockroachDB
There is a class of Bazel build errors that Gazelle can’t handle, and manual intervention is necessary. In this case you typically need...
Read more >
Building a Go project using Bazel - Tweag
Gazelle looks at the Go source files and generates Bazel BUILD files ... ERROR: /tendermint/third_party/proto/gogoproto/BUILD.bazel:5:14: no ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found