runtime-error - 在针对 ARM 64 架构交叉编译的 android 上运行 Tf 项目的可执行文件时出错
问题描述
我正在开发一个 TensorFlow-lite 解决方案,以部署在 ARM-64 架构上。我使用 android ndk 独立工具链交叉编译了我们的 C 代码。我包含了编译所需的所有库,并在编译时成功获得了一个 out.exe 文件和一个 out.so 文件。但是在尝试在具有 arm64 架构的 android 手机上运行 .exe 文件时(使用 adb shell 环境并推送编译期间使用的所有必需库和 out.so 获得)它给出了空指针取消引用错误。这是执行.exe文件后在cmd上得到的错误日志——
WARNING: linker: Warning: "/data/snd/NC2/libtensorflowlite_c.so" unused DT entry: DT_RPATH (type 0xf arg 0xf68) (ignoring)
WARNING: linker: Warning: "/data/snd/NC2/libpthread.so.0" has unsupported flags DT_FLAGS_1=0x29 (ignoring unsupported flags)
WARNING: linker: Warning: "/data/snd/NC2/libpthread.so.0" has unsupported flags DT_FLAGS_1=0x29 (ignoring unsupported flags)
WARNING: linker: Warning: "/data/snd/NC2/libpthread.so.0" has unsupported flags DT_FLAGS_1=0x29 (ignoring unsupported flags)
WARNING: linker: Warning: "/data/snd/NC2/libtensorflowlite_c.so" unused DT entry: DT_RPATH (type 0xf arg 0xf68) (ignoring)
WARNING: linker: Warning: "/data/snd/NC2/libpthread.so.0" has unsupported flags DT_FLAGS_1=0x29 (ignoring unsupported flags)
Segmentation fault (core dumped)
这是获得的日志文件 -
12-04 12:25:37.178 4209 4209 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x68
12-04 12:25:37.178 4209 4209 F DEBUG : Cause: null pointer dereference
12-04 12:25:37.178 4209 4209 F DEBUG : x0 0000000000000000 x1 000000775bd15ff8 x2 0000000000000000 x3 0000000000000001
12-04 12:25:37.178 4209 4209 F DEBUG : x4 0000008000000000 x5 0000000000000000 x6 0000000080000000 x7 00000000003880f3
12-04 12:25:37.178 4209 4209 F DEBUG : x8 000000000000000a x9 00000000000819f8 x10 000000775bd08000 x11 0000000000000020
12-04 12:25:37.178 4209 4209 F DEBUG : x12 0000000000000018 x13 0000000000000008 x14 000000775c9e1cc0 x15 0000000000000008
12-04 12:25:37.179 4209 4209 F DEBUG : x16 ffffffffffffffff x17 0000000000000030 x18 000000775cf20000 x19 000000775bd899f8
12-04 12:25:37.179 4209 4209 F DEBUG : x20 0000000000000018 x21 000000000000001c x22 0000001c00000402 x23 000000775dc89000
12-04 12:25:37.179 4209 4209 F DEBUG : x24 0000000000249430 x25 000000775bd15ff8 x26 000000775dc89000 x27 000000775be9f2b0
12-04 12:25:37.179 4209 4209 F DEBUG : x28 000000775be95000 x29 0000007fe049c150
12-04 12:25:37.179 4209 4209 F DEBUG : sp 0000007fe049c140 lr 000000775dbab6c0 pc 000000775bd89a00
12-04 12:25:37.193 4209 4209 F DEBUG :
12-04 12:25:37.193 4209 4209 F DEBUG : backtrace:
12-04 12:25:37.193 4209 4209 F DEBUG : NOTE: Function names and BuildId information is missing for some frames due
12-04 12:25:37.194 4209 4209 F DEBUG : NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
12-04 12:25:37.194 4209 4209 F DEBUG : NOTE: found under the lib/ directory are readable.
12-04 12:25:37.194 4209 4209 F DEBUG : NOTE: On this device, run setenforce 0 to make the libraries readable.
12-04 12:25:37.194 4209 4209 F DEBUG : #00 pc 0000000000081a00 /data/snd/NC2/libc.so.6
12-04 12:25:37.194 4209 4209 F DEBUG : #01 pc 000000000003e6bc /apex/com.android.runtime/bin/linker64 (__dl__Z19call_ifunc_resolvery+16) (BuildId: 4a559408e8da42af235cf9e971c68c35)
我为交叉编译包含的库列表是 - libtensorflowlite_c.so、libpthread.so.0、ld-linux-aarch64.so.1、libc.so.6 libc++.so、libdl.so.2、libm.so .6、librt.so.1、libstdc++.so.6、libgcc_s.so.1。(所有这些库都将 Linux 作为操作系统,将 arm64 作为要部署的架构)。
解决方案
推荐阅读
- c# - SaveChanges() 长事务中的“基础提供程序在打开时失败”错误
- c# - 如何在方法中将密码作为参数传递
- javascript - 这种使用 html5 视频的技术叫什么?
- c# - MVC项目启动
- javascript - 获得对象的缩放宽度:缩放
- node.js - Angular 和 Node.js:获取调用解析数据到对象
- javascript - 回调函数以某种方式返回未定义
- ios - 快速表格视图单元格不允许我使用 indexPath.row
- angular - Promise 或然后 onAuthStateChanged 函数
- android - 如何在约束布局中水平匹配两个元素?