android-ndk - 在 android ndk 中包含外部库 libxml2 时出现 undefined reference 错误

标签 android-ndk libxml2

我正在尝试将 libxml2 与 android ndk 一起使用。当我运行 make 文件时,出现错误,提示文件“unicode/ucnv.h”不存在。我已经看到“unicode/ucnv.h”包含在其中一个文件中,并且不存在这样的头文件。所以我从http://site.icu-project.org/下载了unicode头文件并将它们放入包含文件夹中。

现在之前的错误已经消失,但我遇到了这些错误。

共享库:libxml2.so

./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `openIcuConverter':
C:\test\hello-jni/jni/encoding.c:109: undefined reference to `ucnv_open_49'
C:\test\hello-jni/jni/encoding.c:115: undefined reference to `ucnv_setToUCallBack_49'
C:\test\hello-jni/jni/encoding.c:119: undefined reference to `ucnv_setFromUCallBack_49'
C:\test\hello-jni/jni/encoding.c:126: undefined reference to `ucnv_open_49'
C:\test\hello-jni/jni/encoding.c:132: undefined reference to `ucnv_close_49'
C:\test\hello-jni/jni/encoding.c:135: undefined reference to `UCNV_TO_U_CALLBACK_STOP_49'
C:\test\hello-jni/jni/encoding.c:135: undefined reference to `UCNV_FROM_U_CALLBACK_STOP_49'
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `closeIcuConverter':
C:\test\hello-jni/jni/encoding.c:141: undefined reference to `ucnv_close_49'
C:\test\hello-jni/jni/encoding.c:142: undefined reference to `ucnv_close_49'
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `xmlUconvWrapper':
C:\test\hello-jni/jni/encoding.c:1865: undefined reference to `ucnv_convertEx_49'
C:\test\hello-jni/jni/encoding.c:1870: undefined reference to `ucnv_convertEx_49'

collect2: ld 返回 1 退出状态 make: * [obj/local/armeabi/libxml2.so] 错误 1

我在任何文件中都没有找到函数 ucnv_open_49。 我是唯一一个面临这个问题的人吗?

最佳答案

与 libxml2 一起构建 unicode 库 (icu) 并在 LOCAL_SHARED_LIBRARIES 中提及。 就是这样!

关于android-ndk - 在 android ndk 中包含外部库 libxml2 时出现 undefined reference 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10731880/

相关文章:

android - 不能在 Cygwin 上使用 ndk-build

android - 是否可以为 Android Studio 创建仅使用 CMake 的项目?

php - 使用 PHP XMLReader 检测 XML 自闭标签

c++ - 在 FreeBSD 上构建 lxml 示例时未定义对 glib 的引用

ruby - 为什么 "gem"和 "bundle"不使用相同的 libxml2?

c++ - 是否可以在 C++ 中禁用 stderr?

java - Android JAVA 中的 SWIGTYPE_p_unsigned_char 打印

Android NDK 二进制文件大小

c++ - Android NDK 优缺点

c - ANTLR C目标和XMLLib