问题描述
bazel build时报错
INFO: Invocation ID: 318692d6-22e8-4e2b-be65-7e222ba577fa
ERROR: D:/tensorflow-1.13.1/source/tensorflow/core/kernels/BUILD:4680:1: no such package '@icu//': java.io.IOException: Error downloading [http://localhost/release-62-1.tar.gz, https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz, https://github.com/unicode-org/icu/archive/release-62-1.tar.gz] to C:/users/administrator/_bazel_administrator/y46qiod6/external/icu/release-62-1.tar.gz: Checksum was 757001f94a669b374b8d684561e9b6491aab243a0e0a9d78ed32a273685e3eb4 but wanted e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761 and referenced by '//tensorflow/core/kernels:string_util'
ERROR: Analysis of target '//tensorflow:libtensorflow_cc.so' failed; build aborted: no such package '@icu//': java.io.IOException: Error downloading [http://localhost/release-62-1.tar.gz, https://mirror.bazel.build/github.com/unicode-org/icu/archive/release-62-1.tar.gz, https://github.com/unicode-org/icu/archive/release-62-1.tar.gz] to C:/users/administrator/_bazel_administrator/y46qiod6/external/icu/release-62-1.tar.gz: Checksum was 757001f94a669b374b8d684561e9b6491aab243a0e0a9d78ed32a273685e3eb4 but wanted e15ffd84606323cbad5515bf9ecdf8061cc3bf80fb883b9e6aa162e485aa9761
INFO: Elapsed time: 825.988s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (98 packages loaded, 6304 targets configured) Fetching @grpc; fetching 818s Fetching @icu; fetching 815s WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files: d:\tensorflow-1.13.1\source/.bazelrc INFO: Invocation ID: fd13f726-c4b8-4f5b-8cd8-ef51b3aff143
主要是icu模块的release-62-1.tar.gz包下载失败。
以为是网络不稳定,试了N次,几乎每次都是出现这个报错。查了一下才发现需要梯子,导致powershell编译时下载包失败!
解决方案
通过chrome浏览器下载release-62-1.tar.gz包(浏览器也需要梯子,不过浏览器下载容易的多),然后将tar.gz包上传到http文件服务器,通过http文件服务器加载tar.gz包。具体操作可参考怎么在本地架设一个简单的HTTP服务器?
在tensorflow/third_party/icu/workspace.bzl中urls中加入tar.gz包在http文件服务中的路径:
重新build,问题完美解决!