【发布时间】:2012-01-12 18:58:42
【问题描述】:
我正在使用https://github.com/eighthave/openssl-android 提供的 open-ssl 源代码 构建一个可以在android项目中使用的库。
根据 README.txt 中给出的说明,我能够为 Android 平台版本 2.2(级别 -8)编译它
但我的应用要求它兼容 2.1(级别 -7)。
我使用 default.properties 文件 (https://github.com/eighthave/openssl-android/blob/master/default.properties) 尝试了以下选项
1) 设置目标=android-7
2) 设置目标=android-5
但是当我使用命令 ndk-build 编译它时,它会给出以下错误
Compile thumb : crypto <= dsa_vrf.c
Compile thumb : crypto <= dso_dl.c
Compile thumb : crypto <= dso_dlfcn.c
/Crypto/openssl-android/crypto/dso/dso_dlfcn.c: In function 'dlfcn_pathbyaddr':
/Crypto/openssl-android/crypto/dso/dso_dlfcn.c:445: error: 'Dl_info' undeclared (first use in this function)
/Crypto/openssl-android/crypto/dso/dso_dlfcn.c:445: error: (Each undeclared identifier is reported only once
/Crypto/openssl-android/crypto/dso/dso_dlfcn.c:445: error: for each function it appears in.)
/Crypto/openssl-android/crypto/dso/dso_dlfcn.c:445: error: expected ';' before 'dli'
/Crypto/openssl-android/crypto/dso/dso_dlfcn.c:455: error: 'dli' undeclared (first use in this function)
make: *** [obj/local/armeabi/objs/crypto/dso/dso_dlfcn.o] Error 1
根据错误消息 - Dl_info 未定义。但是如果我们转到文件 dso_dlfcn.c ,则已经提供了结构的定义。 (https://github.com/eighthave/openssl-android/blob/master/crypto/dso/dso_dlfcn.c)
并且此代码在默认属性文件中为 target=android-8 编译,但不适用于 android-7 或 android-5。
请求您帮助我解决此错误。并让我知道需要进行哪些更改才能为 android 2.1 平台编译它。
提前致谢。
【问题讨论】:
-
OpenSSL wiki 上还有 OpenSSL and Android。
标签: android java-native-interface openssl android-ndk shared-libraries