在使用bazel編譯tensorflow和tensorflow/tools/graph_transforms:transform_graph的過程中,出現某些資源無法下載下傳的情況。
如:
bazel build tensorflow/tools/graph_transforms:transform_graph
會遇到
Error downloading [
https://storage.googleapis.com/mirror.tensorflow.org/github.com/aws/aws-sdk-cpp/archive/1.5.8.tar.gz,
https://github.com/aws/aws-sdk-cpp/archive/1.5.8.tar.gz] to
/home/略略略/.cache/bazel/_bazel_略略略/ae268aa41b50ed3f4ec4a64fae0a392e/external/aws/1.5.8.tar.gz
嘗試了 tsocks 也不好用。我們去他家問問。
https://github.com/bazelbuild/bazel/search?q=proxy&type=Issues
果然早就出現了,這裡
Unfortunately, bazel's download utility and proxies is a known issue.
A quick work around is to manually download the needed files and put them to some directory. Then you can tell bazel using the
option to first search there before even going to network, e.g.,
--distdir
bazel build --distdir /path/to/where/you/put/the/files/ //src:bazel
.
Also, if you have a jdk on your system already (e.g., the one taken from your distribution) there is no need to download one freshly; you can tell bazel to using by providing the option
, i.e.,
[email protected]_jdk//:jdk
.
bazel build [email protected]_jdk//:jdk //src:bazel
是以解決方法很簡單,首先,用浏覽器或者tsocks wget把需要下載下傳檔案弄下來,放在某個檔案夾,如
tsocks wget https://github.com/aws/aws-sdk-cpp/archive/1.5.8.tar.gz
tsocks wget https://github.com/unicode-org/icu/archive/release-64-2.zip
然後增加選項 --distdir /home/略略略/Downloads/
tsocks bazel build --distdir /home/略略略/Downloads/ tensorflow/tools/graph_transforms:transform_graph
就可以順利編譯了。
前置條件:
Linux 下有好用的 tsocks 一套。
powershell的話……鬼知道怎麼辦。