gpt4 book ai didi

android - 为平台 2.1 构建 Android-openssl 库

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:56:07 26 4
gpt4 key购买 nike

我正在使用 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 平台编译它需要做哪些更改。

提前致谢。

最佳答案

尝试在 dso_dlfcn.c 中包含以下代码:

typedef struct {
const char *dli_fname; /* Pathname of shared object that
contains address */
void *dli_fbase; /* Address at which shared object
is loaded */
const char *dli_sname; /* Name of nearest symbol with address
lower than addr */
void *dli_saddr; /* Exact address of symbol named
in dli_sname */
} Dl_info;
int dladdr(const void *addr, Dl_info *info) { return 0; }

之前:

#ifdef __linux
# ifndef _GNU_SOURCE
# define _GNU_SOURCE /* make sure dladdr is declared */
# endif
#endif

之后,在我的例子中,图书馆就建好了。

关于android - 为平台 2.1 构建 Android-openssl 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8378493/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com