I just learned to use bazel to build google glog project. My computer network is blocked. I've downloaded glog which gflag dependents to the directory '/home/jamescook/lab/test/new-glog/download/ '.
Now, I run the follow command:
bazel build --distdir=/home/jamescook/lab/test/new-glog/download/ glog
then build error happens,follow is the detail info:
bazel build --distdir=/home/jamescook/lab/test/new-glog/download/ glog
INFO: Call stack for the definition of repository 'com_github_gflags_gflags' which is a http_archive (rule definition at /root/.cache/bazel/_bazel_root/4103e065900cc37ff22791b2ccc18505/external/bazel_tools/tools/build_defs/repo/http.bzl:296:16):
/home/jamescook/lab/test/new-glog/glog-0.4.0/WORKSPACE:3:1
WARNING: Download from https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz failed: class java.net.ConnectException Network is unreachable (connect failed)
WARNING: Download from https://github.com/gflags/gflags/archive/v2.2.2.tar.gz failed: class java.net.ConnectException Network is unreachable (connect failed)
ERROR: An error occurred during the fetch of repository 'com_github_gflags_gflags':
java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz, https://github.com/gflags/gflags/archive/v2.2.2.tar.gz] to /root/.cache/bazel/_bazel_root/4103e065900cc37ff22791b2ccc18505/external/com_github_gflags_gflags/v2.2.2.tar.gz: Network is unreachable (connect failed)
ERROR: /home/jamescook/lab/test/new-glog/glog-0.4.0/BUILD:5:1: //:glog depends on @com_github_gflags_gflags//:gflags in repository @com_github_gflags_gflags which failed to fetch. no such package '@com_github_gflags_gflags//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz, https://github.com/gflags/gflags/archive/v2.2.2.tar.gz] to /root/.cache/bazel/_bazel_root/4103e065900cc37ff22791b2ccc18505/external/com_github_gflags_gflags/v2.2.2.tar.gz: Network is unreachable (connect failed)
ERROR: Analysis of target '//:glog' failed; build aborted: no such package '@com_github_gflags_gflags//': java.io.IOException: Error downloading [https://mirror.bazel.build/github.com/gflags/gflags/archive/v2.2.2.tar.gz, https://github.com/gflags/gflags/archive/v2.2.2.tar.gz] to /root/.cache/bazel/_bazel_root/4103e065900cc37ff22791b2ccc18505/external/com_github_gflags_gflags/v2.2.2.tar.gz: Network is unreachable (connect failed)
INFO: Elapsed time: 25.645s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
My question is whether bazel's distdir option didn't work or whether I used it incorrectly.
If I used it wrong, how should I change it?
Did you place these unreachable files in /home/jamescook/lab/test/new-glog/download/ separately? Distdir works by reaching into the specified directory for the required files, instead of connecting to the internet for them.
Yes, I downloaded the dependency package glog in advance ,in /home/jamescook/lab/test/new-glog/download/. Can you give me an example of how to use the Distdir option correctly?I can't find it in bazel's official guide and that will help me a lot.
Did you manage find the right command?
Yes, use “--override_repository” option.
Most helpful comment
Yes, I downloaded the dependency package glog in advance ,in /home/jamescook/lab/test/new-glog/download/. Can you give me an example of how to use the Distdir option correctly?I can't find it in bazel's official guide and that will help me a lot.