基本上,我想使用自定义LLVM存储库运行TensorFlow,而不是bazel从中运行的llvm镜像。
我做了以下更改:
将temp_workaround_http_archive
中的//tensorflow/workspace.bzl
规则更改为:
native.local_repository (
name = "llvm",
path = "/git/llvm/",
)
在/git/llvm
中,我添加了包含以下内容的文件WORKSPACE
workspace( name = "llvm" )
但是,我知道需要llvm.build
个文件,但由于我是bazel的新手,我不确定它应该位于何处。
我收到以下错误日志:
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
ERROR: /git/tensorflow/tensorflow/tools/pip_package/BUILD:81:1: no such package '@llvm//': BUILD file not found on package path and referenced by '//tensorflow/tools/pip_package:licenses'.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.
INFO: Elapsed time: 0.219s
我从源代码安装了TensorFlow。这是版本信息:
$ git rev-parse HEAD
4c3bb1aeb7bb46bea35036433742a720f39ce348
$ bazel version
Build label: 0.4.5
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Mar 16 12:19:38 2017 (1489666778)
Build timestamp: 1489666778
Build timestamp as int: 1489666778
提前感谢您的帮助!
答案 0 :(得分:2)
找到修复程序。实际上非常简单。
bazel中的local_repository
规则仅适用于外部bazel存储库。要使用非bazel外部存储库,我们需要使用new_local_repository
作为参数。
答案 1 :(得分:0)
您可以使用python的http服务器功能来构建本地文件服务器,例如:
python3 -m http.server
然后编辑文件“ tensorflow / workspace.bzl”
tf_http_archive(
name = "llvm",
urls = [
"https://mirror.bazel.build/**/195a164675af86f390f9816e53291013d1b551d7.tar.gz",
"http://localhost:8000/195a164675af86f390f9816e53291013d1b551d7.tar.gz",
"https://github.com/**/195a164675af86f390f9816e53291013d1b551d7.tar.gz",
],
sha256 = "57a8333f8e6095d49f1e597ca18e591aba8a89d417f4b58bceffc5fe1ffcc02b",
strip_prefix = "llvm-195a164675af86f390f9816e53291013d1b551d7",
build_file = str(Label("//third_party/llvm:llvm.BUILD")),
)
在网址的中间一行添加一个本地文件路径,然后再次重建它。