无法使用bazel从源代码构建TensorFlow。 2016年1月22日

问题描述:

我想从源代码安装最新的TensorFlow。我把资料库,然后跑去无法使用bazel从源代码构建TensorFlow。 2016年1月22日

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

我得到这个错误:

ERROR: /home/samuelchin/tensorflow/tensorflow/models/embedding/BUILD:10:6: First argument of load() is a path, not a label. It should start with a single slash if it is an absolute path. 
ERROR: /home/samuelchin/tensorflow/tensorflow/models/embedding/BUILD:10:6: file '/tensorflow:tensorflow.bzl.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file. 
ERROR: /home/samuelchin/tensorflow/tensorflow/models/embedding/BUILD:104:1: name 'tf_gen_op_wrapper_py' is not defined. 
ERROR: /home/samuelchin/tensorflow/tensorflow/tools/pip_package/BUILD:13:1: Target '//tensorflow/models/embedding:package' contains an error and its package is in error and referenced by '//tensorflow/tools/pip_package:build_pip_package'. 
ERROR: Loading failed; build aborted. 
INFO: Elapsed time: 0.071s. 

对TensorFlow BUILD文件进行了最近更改,导致依赖于Bazel 0.1.4。这是[email protected]邮件列表上的announced,但尚未将其纳入网站的文档中。

正如你已经发现的,升级Bazel到version 0.1.4应该修复这个构建错误。

原来,巴泽尔已经过时。我的bazel以前的版本是0.1.2,最后在12月更新。 Bazel此后被更新至0.1.4。对于那些有这个错误的人来说,更新bazel可以做到这一点。然后您可以按照常规进行构建。

我想在将来,如果它不能建立,你可能想检查bazel是否更新到最新版本。

+1

我不会特别推荐最新版本。 IIRC有一段时间,Bazel 0.1.1可以工作,0.1.2不能工作,0.1.2是最新版本。这是特定版本的工作,而不是最新版本。我知道巴泽尔集团一直在关注让巴泽尔为TensorFlow的公开版继续工作,但我不知道细节。 –