【问题标题】:Building Tensorflow with Bazel fails (Ubuntu 18.04, Cuda 9.1)使用 Bazel 构建 TensorFlow 失败(Ubuntu 18.04、Cuda 9.1)
【发布时间】:2019-02-11 19:23:24
【问题描述】:

我正在尝试跟随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)
  • 库达 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

【问题讨论】:

    标签: tensorflow bazel ubuntu-18.04


    【解决方案1】:

    TensorFlow 需要最新版本的 protobuf。您是否有可能拥有早于 3.6.0 的 protobuf 版本? 您能否将系统上的 protobuf 版本更新到最新(3.6.1),运行bazel clean,重新配置并重建 tensorflow?

    【讨论】:

    • 我使用以下命令更新了 protobuf:pip install protobuf。但同样的问题仍然出现。是因为 protobuf 更新发生在 anaconda3 库中吗?
    • 我按照here 的一些命令安装了最新版本的 protobuf (3.6.1)。我清理了 bazel 并重新启动它,但没有任何改变。
    【解决方案2】:

    我和你有同样的问题。我尝试了许多版本的 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

    【讨论】:

      【解决方案3】:

      将 protobuf 更新到 3.6.1 版不会对您的 tensorflow 安装/编译产生影响。 tensorflow 的编译是使用 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 版本。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-29
        相关资源
        最近更新 更多