android-ndk - Android NDK 链接共享库
问题描述
我目前正在尝试将 3 个预构建的共享库链接到本机 JNI 共享库。共享库是在 linux 上构建的。当我将其中一个库链接到本机 JNI 时,我收到了一个不令人满意的链接错误,附在下面。
Loading the library normally failed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libc.so.6" not found.
我的共享库(libdivsufsort)的运行时依赖关系如下所示
Dynamic section at offset 0x9e00 contains 25 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname [libdivsufsort.so.3]
0x000000000000000c (INIT) 0x8b8
0x000000000000000d (FINI) 0x85c8
0x0000000000000019 (INIT_ARRAY) 0x209de8
0x000000000000001b (INIT_ARRAYSZ) 8 (bytes)
0x000000000000001a (FINI_ARRAY) 0x209df0
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x1f0
0x0000000000000005 (STRTAB) 0x510
0x0000000000000006 (SYMTAB) 0x258
0x000000000000000a (STRSZ) 375 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0x20a000
0x0000000000000002 (PLTRELSZ) 216 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x7e0
0x0000000000000007 (RELA) 0x708
0x0000000000000008 (RELASZ) 216 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x6c8
0x000000006fffffff (VERNEEDNUM) 1
0x000000006ffffff0 (VERSYM) 0x688
0x000000006ffffff9 (RELACOUNT) 3
0x0000000000000000 (NULL) 0x0
我的其他图书馆也出现了类似的问题。该链接在 linux 上运行良好,因为 libc.so.6 在库路径中。android 似乎不支持与版本库的动态链接,也不在 system/lib 中包含版本库。我该如何解决这个问题?
解决方案
推荐阅读
- javascript - 使用immer时如何更新reducer中的状态(初始状态)对象?
- php - PHP检查不同数组中的某些值是否对所有人都相同
- python - 具有循环洗发水调节功能
- c++ - 由于堆栈溢出,与 Karatsuba 的大整数乘法会因分段错误而崩溃
- python - 在我的 Django 项目中保存对象时自定义确认屏幕?
- mysql - 简化并更正以下查询
- python - 在调用python函数之前存储字段要求?
- python - 如何将 lambda 从 Python2 转换为 Python3?
- python - 在有限的时间内抓取 Twitter
- java - 如何将 2d 数组的一行的一部分复制到 1d 数组中?