在 CentOS 7 上构建 Tensorflow 时出错

Error building Tensorflow on CentOS 7

我正在尝试在 CentOS 7 上编译 Tensorflow (r1.3)。

My environment: gcc (g++) 7.20, bazel 0.5.3, python3 (with all necessary dependencies listed on tensorflow web site), swig 3.0.12, openjdk 8. Everything is installed in the users scope, without root access.

每当我尝试构建一个 python 包时调用以下命令

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

我收到这个错误:

.....

2017-08-24 11:40:35.734659: W tensorflow/core/framework/op_gen_lib.cc:372] Squeeze can't find input squeeze_dims to rename ERROR: /home/data/software/tensorflow/tensorflow/python/BUILD:2762:1: Couldn't build file tensorflow/python/pywrap_tensorflow_internal.cc: SWIGing tensorflow/python/tensorflow.i failed (Exit 1).

...

但是构建 C++ 库 (bazel build --config=opt //tensorflow:libtensorflow_cc.so) 没有任何问题

我是不是做错了什么?

2017 年 8 月 25 日更新: 好的,似乎 SWIG 是在 运行 bazel build 时从源代码自动构建的。随附的 SWIG 版本为 3.0.8。但是,我仍然不知道如何解决这个问题。

好的,问题已通过使用 bazel 0.5.1 版本解决。较新的版本产生相同的错误。