【发布时间】:2016-08-29 17:29:26
【问题描述】:
我在使用 TensorFlow 时遇到了一点问题。我必须将使用 TF 的代码集成到已经存在的项目(使用 Makefile)中。所以这就是我所做的。
我从源头获得了 TF 并按照on the TF site. 的描述安装了它
然后我建立了一个共享库:
bazel build //tensorflow:libtensorflow.so
完成此操作后,我将以下行添加到 Makefile:
CFLAGS += -I/home/alpy/tensorflow/bazel-genfiles
CFLAGS += -I/home/alpy/tensorflow/
CFLAGS += -I/home/alpy/tensorflow/third_party/eigen3
LDFLAGS += -L/home/alpy/tensorflow/bazel-bin/tensorflow
LDFLAGS += -ltensorflow
当我尝试成功时,我得到了这个奇妙的错误:link
编辑:我忘了解释一些东西。我在 Linux 上,所以编译器应该区分大小写。我检查了我的文件和 TF 文件,它们似乎都有#ifndef 保护。
编辑:根据我的建议,我将错误直接添加到帖子中:
In file included from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
[...]
from /home/alpy/tensorflow/tensorflow/core/public/session.h:23,
from ../src/conversion.h:11,
from ../src/detect_fast_C.cpp:43:
/home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply
In file included from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:0,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
from /home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1,
[...]
from /home/alpy/tensorflow/tensorflow/core/framework/types.h:23,
from /home/alpy/tensorflow/tensorflow/core/framework/type_traits.h:22,
from /home/alpy/tensorflow/tensorflow/core/framework/allocator.h:25,
from /home/alpy/tensorflow/tensorflow/core/framework/tensor.h:21,
from /home/alpy/tensorflow/tensorflow/core/public/session.h:23,
from ../src/conversion.h:11,
from ../src/detect_fast_C.cpp:43:
/home/alpy/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:42: error: #include nested too deeply
(这会持续一段时间)
【问题讨论】:
标签: c++ makefile tensorflow bazel