使用 tensorflow_cc.so

问题描述

我正在将 Tensorflow2 共享库 (*.so) 文件链接到我的 C++ 程序中。 libtensorflow_cc 和 libtensorflow_framework.so 使用 bazel-3.7.2 和 gcc7.3,并链接我有libmyproj.so”的另一个库。我想将此 libmyproj.so 链接到使用相同 gcc7.3 构建的主程序。我曾尝试使用 -D_GLIBCXX_USE_CXX11_ABI=0 标志来实现 ABI 兼容性(来自 https://www.tensorflow.org/install/sourceConverting std::__cxx11::string to std::string),但没有成功。我陷入了以下错误

undefined reference to ml_model::ml_model(std::__cxx11::basic_string<char,std::char_traits<char>,std::allocator<char> >)' undefined reference to ml_model::preprocess_data(std::__cxx11::basic_string<char,std::allocator<char> >,std::vector<float,std::allocator<float> >,int&,std::vector<int,std::allocator<int> >&)' undefined reference to ml_model::get_predictions(std::__cxx11::basic_string<char,std::vector<std::pair<int,int>,std::allocator<std::pair<int,int> > int,std::allocator<int> >)'函数 std::__cxx11::basic_string* tensorflow::internal::MakeCheckOpString(long const&,int const&,char const*)': undefined reference to tensorflow::internal::CheckOpMessageBuilder::NewString[abi:cxx11]()'

关于为什么会发生这种情况的任何建议?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)