【发布时间】:2018-08-22 11:23:06
【问题描述】:
目前,在 Tensorflow 的支持下,我在编译(和运行)一个(巨大的)自己的项目时遇到了一些问题。在我自己的系统(Ubuntu 16.04 LTS)上一切正常。集群上的相同过程会导致编译错误,我还没有找到解决方案。
系统信息
- 我是否编写了自定义代码:是
- 操作系统平台和发行版(例如,Linux Ubuntu 16.04):CentOS 7.4.1708
- TensorFlow 安装自(源代码或二进制文件):源代码(使用 git 存储库)
- TensorFlow 版本(使用下面的命令):1.9
- Python 版本:2.7.15
- Bazel 版本(如果从源代码编译):0.16
- GCC/编译器版本(如果从源代码编译):7.30
- CUDA/cuDNN 版本:未使用
- GPU 型号和内存:Tesla K20m
-
复制的精确命令:
- 从 github 克隆的 tensorflow 存储库
- 配置 Bazel (张量流 repo 中的 ./configure)
- 使用 bazel 构建 libtensorflow_cc.so (工作正常!!!)
- 使用交付的脚本下载依赖项tensorflow/contrib/makefile/download_dependencies.sh (也尝试手动安装 protobuf 和 eigen)!
- 使用 ./autogen.sh && ./configure && make && make install 安装了 protobuf
- 从下载的依赖项中安装 Eigen
-
将库、标头和包含复制到自己的项目中:
$ cp bazel-bin/tensorflow/libtensorflow_cc.so ../tf_project/lib/ $ cp bazel-bin/tensorflow/libtensorflow_framework.so ../tf_project/lib/ $ cp /tmp/proto/lib/libprotobuf.a ../tf_project/lib/ $ mkdir -p ../tf_project/include/tensorflow $ cp -r bazel-genfiles/ * ../tf_project/include/ $ cp -r tensorflow/cc ../tf_project/include/tensorflow $ cp -r tensorflow/core ../tf_project/include/tensorflow $ cp -r third_party ../tf_project/include $ cp -r /tmp/proto/include/ * ../tf_project/include $ cp -r /tmp/eigen/include/eigen3/ * ../tf_project/include
备注:在我自己的系统上,它已经以这种方式工作了数周。我可以在我自己的项目中使用 tensorflow,并在 python 项目中使用 keras 训练的导出模型。我使用 client_sessions 和 tensorflow 框架的许多其他功能进行预测,并且可以正常工作。
问题: 在集群中我可以将 tensorflow 编译为动态库,安装 protobuf 和 eigen。 当我尝试编译我的项目(关于我自己的系统的类似过程)而不进行重大更改时,它不起作用并停止并出现以下错误消息:
.../tensorflow/include/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
^~~~~
.../include/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
^~~~~
.../include/tensorflow/core/framework/tensor.pb.h:14:2: error: #error your headers.
#error your headers.
^~~~~
.../include/tensorflow/core/framework/tensor.pb.h:27:10: fatal error: google/protobuf/inlined_string_field.h: No such file or directory
#include <google/protobuf/inlined_string_field.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
所以,显然这应该是问题所在:
此文件由新版本的 protoc 生成,该版本与您的 Protocol Buffer 标头不兼容。请更新您的标题。
和
致命错误: google/protobuf/inlined_string_field.h:没有这样的文件或目录
尝试过的解决方案:
- 我尝试了不同版本的 protobuf,但每次尝试都会出错。
- 我尝试手动安装 protobuf 和 eigen(没有 download_dependencies.sh 脚本)
我想知道,因为我自己的安装遵循完全相同的步骤可以正常工作。除非我尝试了不同的版本以确保这些不是“新”问题,否则其中一个组件可能存在问题。
谁能帮我解决这个错误,我可以在另一台机器上编译和运行这个项目?
期待获得有用的解决方案:) 非常感谢您的支持!
来自德国的问候!
【问题讨论】:
-
我可能是即使你已经安装了 protobuf 系统正在从另一个地方获取它。检查您的
PATH以查看它正在使用哪个 protobuf。 -
感谢您的评论。不幸的是,这个系统中只有一个 protobuf 安装。那就是我在第 5 步之后安装的!
标签: c++ tensorflow