TensorFlow 2.8 cmake静态构建的静态库,显示RUY的未定义参考,FlatBuffers

发布于 2025-01-26 09:58:22 字数 2229 浏览 2 评论 0 原文

我使用CMAKE构建了Tensorflow-lite.a,使用 tensorflow cmake cmake cmake build 的指令。

但是,当试图在CPP应用程序中使用此库时,我会遇到未定义的参考错误(主要来自Ruy)。

  1. 我的猜测是tensorflow-lite。A不包含所有必要库,例如Ruy,我正确吗?
  2. 我需要单独构建Ruy吗?使用TensorFlow-Lite?
  3. 使用此静态库的唯一方法是在您的cmake中添加sub_directory?

附加错误日志:

Init(TfLiteContext*, char const*, unsigned long)':
mfcc.cc:(.text+0x15c0): undefined reference to `flatbuffers::ClassicLocale::instance_'
mfcc.cc:(.text+0x1634): undefined reference to `flatbuffers::ClassicLocale::instance_'
mfcc.cc:(.text+0x16aa): undefined reference to `flatbuffers::ClassicLocale::instance_'
mfcc.cc:(.text+0x1b7b): undefined reference to `flatbuffers::ClassicLocale::instance_'
.
.
.
mirror_pad.cc:(.text+0x138e): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x13a5): undefined reference to `ruy::ThreadPool::ExecuteImpl(int, int, ruy::Task*)'
mirror_pad.cc:(.text+0x1460): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1479): undefined reference to `ruy::ThreadPool::ExecuteImpl(int, int, ruy::Task*)'
mirror_pad.cc:(.text+0x1534): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x154d): undefined reference to `ruy::ThreadPool::ExecuteImpl(int, int, ruy::Task*)'
mirror_pad.cc:(.text+0x1763): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x190b): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1ab2): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1c69): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1e3a): undefined reference to `ruy::Context::mutable_thread_pool()'
/path/libtensorflow-lite.a(numeric_verify.cc.o): In function `tflite::ops::custom::numeric_verify::Init(TfLiteContext*, char const*, unsigned long)':
numeric_verify.cc:(.text+0xcd1): undefined reference to `flatbuffers::ClassicLocale::instance_'
numeric_verify.cc:(.text+0x10e7): undefined reference to `flatbuffers::ClassicLocale::instance_'

I built tensorflow-lite.a with cmake using instruction from tensorflow cmake build.

But when trying to use this library in cpp application I'm getting undefined reference errors (mostly from ruy).

  1. My guess is tensorflow-lite.a does not contain all the necessery libraries like ruy, am I correct??
  2. Do I need to build RUY separately ?? to use tensorflow-lite??
  3. Is only way possible to use this static library is by adding sub_directory in your cmake ??

Attaching a log of error:

Init(TfLiteContext*, char const*, unsigned long)':
mfcc.cc:(.text+0x15c0): undefined reference to `flatbuffers::ClassicLocale::instance_'
mfcc.cc:(.text+0x1634): undefined reference to `flatbuffers::ClassicLocale::instance_'
mfcc.cc:(.text+0x16aa): undefined reference to `flatbuffers::ClassicLocale::instance_'
mfcc.cc:(.text+0x1b7b): undefined reference to `flatbuffers::ClassicLocale::instance_'
.
.
.
mirror_pad.cc:(.text+0x138e): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x13a5): undefined reference to `ruy::ThreadPool::ExecuteImpl(int, int, ruy::Task*)'
mirror_pad.cc:(.text+0x1460): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1479): undefined reference to `ruy::ThreadPool::ExecuteImpl(int, int, ruy::Task*)'
mirror_pad.cc:(.text+0x1534): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x154d): undefined reference to `ruy::ThreadPool::ExecuteImpl(int, int, ruy::Task*)'
mirror_pad.cc:(.text+0x1763): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x190b): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1ab2): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1c69): undefined reference to `ruy::Context::mutable_thread_pool()'
mirror_pad.cc:(.text+0x1e3a): undefined reference to `ruy::Context::mutable_thread_pool()'
/path/libtensorflow-lite.a(numeric_verify.cc.o): In function `tflite::ops::custom::numeric_verify::Init(TfLiteContext*, char const*, unsigned long)':
numeric_verify.cc:(.text+0xcd1): undefined reference to `flatbuffers::ClassicLocale::instance_'
numeric_verify.cc:(.text+0x10e7): undefined reference to `flatbuffers::ClassicLocale::instance_'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凯凯我们等你回来 2025-02-02 09:58:22
  1. Microsoft Visual C ++可重新分布的最新支持下载


  2. python 3.7+ 64 bit Windows版本

  3. ”与cmakelist中的目录中的目录相同,请访问“ f:/temp/tflite/tensorflow_src/tflite_build/ruy/ruy/ruy/cmakelists.txt”

  4. 使用最后的C ++

    编译

  1. Microsoft Visual C++ Redistributable latest supported downloads
    https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170

  2. Python 3.7+ 64-bit release for Windows
    https://www.python.org/downloads/windows/

  3. Those reading are in the same directory as in the CMakeList at "F:/temp/tflite/tensorflow_src/tflite_build/ruy/ruy/CMakeLists.txt"

  4. Compile using the Lastest C++

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文