OpenHarmony开发者论坛

标题: 参考demo接入Tensorflow Lite库时编译nnrt_delegate.so报错 [打印本页]

作者: xuemingdg    时间: 2023-10-25 10:39
标题: 参考demo接入Tensorflow Lite库时编译nnrt_delegate.so报错
[md]参考[官方demo链接](https://gitee.com/openharmony/ai ... _learning_framework)接入TFLite标签分类模型时,在执行到第三步编译北向demo时报以下错误:

```
[ 25%] Linking CXX shared library ../../../../lib/libnnrt_delegate.so
ld.lld: error: undefined symbol: tflite::tools::ToolParams::AssertParamExists(std::__n1::basic_string<char, std::__n1::char_traits<char>, std::__n1::allocator<char> > const&) const

> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProvider:ogParams(tflite::tools::ToolParams const&, bool) const)
> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProvider:ogParams(tflite::tools::ToolParams const&, bool) const)
> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProvider:ogParams(tflite::tools::ToolParams const&, bool) const)
> > > referenced 32 more times

ld.lld: error: undefined symbol: tflite::tools::ToolParam:aramType tflite::tools::ToolParam::GetValueType<bool>()

> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProvider:ogParams(tflite::tools::ToolParams const&, bool) const)
> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProvider:ogParams(tflite::tools::ToolParams const&, bool) const)
> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProvider:ogParams(tflite::tools::ToolParams const&, bool) const)
> > > referenced 17 more times

ld.lld: error: undefined symbol: tflite::tools::ToolParam::AssertHasSameType(tflite::tools::ToolParam:aramType, tflite::tools::ToolParam:aramType)

> > > referenced by nnrt_delegate_provider.cpp
> > > CMakeFiles/nnrt_delegate.dir/nnrt_delegate_provider.cpp.otflite::tools::NnrtDelegateProv
```

检查了`deep_learning_framework/lib_3rd_nnrt_tflite/include/tensorflow/lite/`下是包含了tflite的头文件的,`deep_learning_framework/lib_3rd_nnrt_tflite/com/arm64-v8a/lib/`包含了编译好的**libtensorflow-lite.so**,但是在`cmake_build`目录下执行`make`就会报以上错误,我是不是依赖做少了什么?






[/md]
作者: xuemingdg    时间: 2023-10-26 16:26
[md]发现之前tflite的so是用GCC编译的,标准库函数签名和OHOS用的clang编译出来的不一样,现在打算用OHOS的clang编译tflite却发现XNNPACK和cpuinfo会报不支持OHOS的错误,这一步不知道该怎么做了

[/md]
作者: xuemingdg    时间: 2023-10-27 11:19
更新一下进度,目前编译北向demo完成,但是推送至设备上运行报以下错误
/bin/sh: ./label_classify: No such file or directory
执行命令是./label_classify -m ./mobilenet_v2.tflite -i ./grace_hopper.bmp -l ./labels.txt -a 1 -z 1
目录下有的文件内容为 grace_hopper.bmp  libneural_network_runtime.z.so  mobilenet_v2.tflite  
label_classify    libnnrt_delegate.so
labels.txt        libnnrt_implementation.so,是否还缺少了什么依赖项呢
作者: xuemingdg    时间: 2023-10-27 14:42
[md]执行了file label_classify显示

```
label_classify: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, BuildID[sha1]=cc170e98796127db83a270cecbb7ab16fe6f1878, with debug_info, not stripped
```

发现hdc shell的/lib/下并没有ld-musl-aarch64.so.1这个文件而只有一个ld-musl-arm.so.1这样的文件,查看一下发现这是arm32位系统的,请问下接下来我应该如何做

补充一下目标设备是dayu200,系统目前安装了OpenHarmony3.2,查看了版本确实是aarch64架构的

[/md]
作者: 论坛小助手    时间: 2023-11-7 09:13
[md]刷一个64位的系统,或者编一个32位版本的可执行程序

[/md]
作者: xxx1004x    时间: 2024-8-12 15:11
回复 xuemingdg: 你好,这个你后面解决了吗? 在鸿蒙编译链下,能出产物吗?希望大佬告知




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5