首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >用Bazel构建Tensorflow失败(Ubuntu 18.04,Cuda 9.1)

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

Stack Overflow用户
提问于 2018-09-06 13:49:25
回答 3查看 955关注 0票数 0

我试图按照本教程安装tensorflow与Cuda9.1,但当我运行以下命令.

代码语言:javascript
运行
复制
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

...I在编译了很长时间后得到了这个错误

代码语言:javascript
运行
复制
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

我的系统设置如下:

  • 英伟达司机版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之后的

代码语言:javascript
运行
复制
pip install protobuf

问题仍在出现:

代码语言:javascript
运行
复制
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
EN

回答 3

Stack Overflow用户

发布于 2018-09-10 05:18:47

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

票数 0
EN

Stack Overflow用户

发布于 2018-09-27 11:24:09

我和你有同样的问题。我尝试过许多版本的protobuf,包括旧版本和最新版本3.6.1。但是,只有3.6.0版本运行良好。

也许您可以尝试ProtobufVersion3.6.0,我希望它会对您有用。

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

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

票数 0
EN

Stack Overflow用户

发布于 2018-10-23 21:20:29

将protobuf更新到3.6.1版不会对您的tensorflow安装/编译产生影响。tensorflow的编译使用Bazel完成,Bazel下载Protobuf的源代码(编写时为3.6.0)。

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

代码语言:javascript
运行
复制
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版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52205607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档