使用Bazel构建Tensorflow失败(Ubuntu 18.04,Cuda 9.1)

时间:2018-09-06 13:49:25

标签: tensorflow bazel ubuntu-18.04

我正在尝试遵循this tutorial来使用Cuda 9.1安装tensorflow,但是当我运行以下命令时...

bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

...长时间编译后出现此错误

INFO: From Compiling tensorflow/core/grappler/clusters/virtual_cluster.cc:
In file included from ./tensorflow/core/framework/common_shape_fns.h:22:0,
                 from ./tensorflow/core/framework/resource_mgr.h:24,
                 from ./tensorflow/core/common_runtime/device.h:43,
                 from ./tensorflow/core/common_runtime/device_set.h:23,
                 from ./tensorflow/core/grappler/clusters/virtual_cluster.h:21,
                 from tensorflow/core/grappler/clusters/virtual_cluster.cc:16:
./tensorflow/core/util/tensor_format.h: In function 'tensorflow::TensorShape tensorflow::ShapeFromFormat(tensorflow::TensorFormat, tensorflow::int64, tensorflow::gtl::ArraySlice<long long int>, tensorflow::int64)':
./tensorflow/core/util/tensor_format.h:501:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (format == FORMAT_NHWC_VECT_W && dim == spatial.size() - 1) {
                                         ~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from ./tensorflow/core/platform/default/logging.h:24:0,
                 from ./tensorflow/core/platform/logging.h:25,
                 from ./tensorflow/core/lib/core/refcount.h:22,
                 from ./tensorflow/core/platform/tensor_coding.h:21,
                 from ./tensorflow/core/framework/resource_handle.h:19,
                 from ./tensorflow/core/framework/allocator.h:24,
                 from ./tensorflow/core/common_runtime/device.h:35,
                 from ./tensorflow/core/common_runtime/device_set.h:23,
                 from ./tensorflow/core/grappler/clusters/virtual_cluster.h:21,
                 from tensorflow/core/grappler/clusters/virtual_cluster.cc:16:
./tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetTensorDim(tensorflow::gtl::ArraySlice<T>, tensorflow::TensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
./tensorflow/core/util/tensor_format.h:452:47:   required from here
./tensorflow/core/util/tensor_format.h:420:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   CHECK(index >= 0 && index < dimension_attributes.size())

./tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
 #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
                                               ^
./tensorflow/core/util/tensor_format.h:420:3: note: in expansion of macro 'CHECK'
   CHECK(index >= 0 && index < dimension_attributes.size())
   ^
./tensorflow/core/util/tensor_format.h: In instantiation of 'T tensorflow::GetFilterDim(tensorflow::gtl::ArraySlice<T>, tensorflow::FilterTensorFormat, char) [with T = long long int; tensorflow::gtl::ArraySlice<T> = absl::Span<const long long int>]':
./tensorflow/core/util/tensor_format.h:461:54:   required from here
./tensorflow/core/util/tensor_format.h:435:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   CHECK(index >= 0 && index < dimension_attribute.size())

./tensorflow/core/platform/macros.h:87:47: note: in definition of macro 'TF_PREDICT_FALSE'
 #define TF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
                                               ^
./tensorflow/core/util/tensor_format.h:435:3: note: in expansion of macro 'CHECK'
   CHECK(index >= 0 && index < dimension_attribute.size())
   ^
ERROR: /usr/lib/x86_64-linux-gnu/tensorflow/tensorflow/contrib/nccl/BUILD:24:1: error while parsing .d file: /home/mounir/.cache/bazel/_bazel_mounir/d313cf0d9cbad5990e55f24fb423f009/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/contrib/nccl/_objs/python/ops/_nccl_ops_gpu/nccl_ops.pic.d (No such file or directory)
In file included from ./tensorflow/core/framework/variant.h:26:0,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:33:0,
                 from ./tensorflow/core/framework/variant.h:26,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/resource_handle.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/resource_handle.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/resource_handle.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:34:0,
                 from ./tensorflow/core/framework/variant.h:26,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:35:0,
                 from ./tensorflow/core/framework/variant.h:26,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/types.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/types.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/types.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/lib/core/status.h:23:0,
                 from ./tensorflow/core/framework/variant.h:29,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/framework/op_kernel.h:27:0,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:33:0,
                 from ./tensorflow/core/framework/op_kernel.h:27,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/attr_value.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/attr_value.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/attr_value.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/framework/op_def_builder.h:24:0,
                 from ./tensorflow/core/framework/op.h:23,
                 from ./tensorflow/core/framework/op_kernel.h:30,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/op_def.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/op_def.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/op_def.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/framework/op_def_util.h:23:0,
                 from ./tensorflow/core/framework/op.h:24,
                 from ./tensorflow/core/framework/op_kernel.h:30,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/api_def.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/api_def.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/api_def.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1904.904s, Critical Path: 126.88s
INFO: 3547 processes: 3547 local.
FAILED: Build did NOT complete successfully

我的系统设置如下:

  • Nvidia驱动程序版本390
  • Ubuntu 18.04
  • GPU Nvidia P400 Quadro(计算能力6.1)
  • CUDA 9.1
  • Cudnn 7.1.3
  • NCCL 2.1.15

编辑: 通过以下方式将protobuf更新为3.6.1之后:

pip install protobuf

问题仍然出现:

ERROR: /home/mounir/tensorflow/tensorflow/contrib/nccl/BUILD:24:1: error while parsing .d file: /home/mounir/.cache/bazel/_bazel_mounir/84217cc82dae4826232c875306f45ef9/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/contrib/nccl/_objs/python/ops/_nccl_ops_gpu/nccl_ops.pic.d (No such file or directory)
In file included from ./tensorflow/core/framework/variant.h:26:0,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:33:0,
                 from ./tensorflow/core/framework/variant.h:26,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/resource_handle.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/resource_handle.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/resource_handle.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:34:0,
                 from ./tensorflow/core/framework/variant.h:26,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor_shape.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/tensor.pb.h:35:0,
                 from ./tensorflow/core/framework/variant.h:26,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/types.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/types.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/types.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/lib/core/status.h:23:0,
                 from ./tensorflow/core/framework/variant.h:29,
                 from ./tensorflow/core/framework/allocator.h:26,
                 from ./tensorflow/core/framework/tensor.h:20,
                 from ./tensorflow/core/framework/log_memory.h:19,
                 from ./tensorflow/core/common_runtime/gpu/gpu_event_mgr.h:21,
                 from ./tensorflow/contrib/nccl/kernels/nccl_manager.h:31,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:21:
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/lib/core/error_codes.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/framework/op_kernel.h:27:0,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from bazel-out/k8-opt/genfiles/tensorflow/core/framework/kernel_def.pb.h:33:0,
                 from ./tensorflow/core/framework/op_kernel.h:27,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/attr_value.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/attr_value.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/attr_value.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/framework/op_def_builder.h:24:0,
                 from ./tensorflow/core/framework/op.h:23,
                 from ./tensorflow/core/framework/op_kernel.h:30,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/op_def.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/op_def.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/op_def.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
In file included from ./tensorflow/core/framework/op_def_util.h:23:0,
                 from ./tensorflow/core/framework/op.h:24,
                 from ./tensorflow/core/framework/op_kernel.h:30,
                 from tensorflow/contrib/nccl/kernels/nccl_ops.cc:22:
bazel-out/k8-opt/genfiles/tensorflow/core/framework/api_def.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
 #error This file was generated by a newer version of protoc which is
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/api_def.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
 #error incompatible with your Protocol Buffer headers.  Please update
  ^~~~~
bazel-out/k8-opt/genfiles/tensorflow/core/framework/api_def.pb.h:14:2: error: #error your headers.
 #error your headers.
  ^~~~~
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1294.361s, Critical Path: 71.52s
INFO: 4743 processes: 4743 local.
FAILED: Build did NOT complete successfully

3 个答案:

答案 0 :(得分:0)

TensorFlow需要最新版本的protobuf。您是否有3.6.0之前的protobuf版本? 您可以将系统上的protobuf版本更新为最新版本(3.6.1),运行bazel clean,重新配置并重建Tensorflow吗?

答案 1 :(得分:0)

我和你有同样的问题。我尝试了许多版本的protobuf,包括较旧的版本和最新的3.6.1。但是,只有3.6.0版才能正常工作。

也许您可以尝试protobuf 3.6.0版,希望它对您有用。

  

顺便说一句,您正在编译tensorflow C ++,需要下载protobuf_cpp_3.6.0.zip而不是使用 pip install protobuf

进行安装

https://github.com/protocolbuffers/protobuf/releases/download/v3.6.0/protobuf-cpp-3.6.0.zip

答案 2 :(得分:0)

将protobuf更新到版本3.6.1不会改变您的tensorflow安装/编译。 tensorflow的编译是使用Bazel完成的,Bazel下载了Protobuf的源代码(在撰写本文时为3.6.0)。

使用3.6.1编译tensorflow的一种方法是编辑tensorflow / tensorflow /目录中的workspace.bzl文件。您将需要更改以下部分:

diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl
index 8e6f414..1493789 100755
--- a/tensorflow/workspace.bzl
+++ b/tensorflow/workspace.bzl
@@ -366,11 +366,11 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
     )

     PROTOBUF_URLS = [
-        "https://mirror.bazel.build/github.com/google/protobuf/archive/v3.6.0.tar.gz",
-        "https://github.com/google/protobuf/archive/v3.6.0.tar.gz",
+        "https://mirror.bazel.build/github.com/google/protobuf/archive/v3.6.1.tar.gz",
+        "https://github.com/google/protobuf/archive/v3.6.1.tar.gz",
     ]
-    PROTOBUF_SHA256 = "50a5753995b3142627ac55cfd496cebc418a2e575ca0236e29033c67bd5665f4"
-    PROTOBUF_STRIP_PREFIX = "protobuf-3.6.0"
+    PROTOBUF_SHA256 = "3d4e589d81b2006ca603c1ab712c9715a76227293032d05b26fca603f90b3f5b"
+    PROTOBUF_STRIP_PREFIX = "protobuf-3.6.1"

     tf_http_archive(
         name = "protobuf_archive",

这样做,您正在更改Bazel用于编译Tensorflow和生成.pb.h文件的protobuf版本。