【发布时间】:2021-07-19 09:40:23
【问题描述】:
我正在将 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/source 和 Converting 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::char_traits<char>, std::allocator<char> >, std::vector<float, std::allocator<float> >, int&, int&, std::vector<int, std::allocator<int> >&)'undefined reference to ml_model::get_predictions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > int, std::vector<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]()'
关于为什么会发生这种情况的任何建议?
【问题讨论】:
标签: c++11 gcc tensorflow2.0