I am trying to compile tensorflow on a Linux machine with a g++ 4.8 compiler. I also need to use it in an external software. The problem is as follows:

when I compile tensorflow (either with bazel or with cmake) I get a libtensorflow.so and libtensorflow_framework.so that export their symbols without the usage of c++11, e.g.

tensorflow::Status:ToString() const.

When I take the headers and try to implement them in my own, external software and when I either link against the libtensorflow or try to use the software with libtensorflow the linker/software complains about

undefined reference to `tensorflow::Status::ToString[abi:cxx11]() const.

Now I've tried several methods. I tried building libtensorflow with

bazel build --cxxopt="-std=c++11" //tensorflow:libtensorflow.so tensorflow:libtensorflow_framework.so

and

bazel build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" //tensorflow:libtensorflow.so tensorflow:libtensorflow_framework.so

but it does not seem to have any effect on the libraries, the exported symbols are still non C++11.

I have also tried to specify

#define GLIBCXX_USE_CXX11_ABI 0

in my external software, before including any standard headers, but the linker still complains about undefined references.

What am I doing wrong? Or is it possible that what I'm trying to do doesn't work at all? With cmake I have tried version 1.8 (it is the only one that compiles for me) and with bazel I have tried 1.10 and 1.11.

0

There are 0 best solutions below