构建Android-OpenSSL库为平台2.1 [英] Build Android-openssl library for platform 2.1

查看:210
本文介绍了构建Android-OpenSSL库为平台2.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 https://github.com/eighthave/openssl-android 给予开放SSL源 建立可以在Android项目中使用的库。

I am using open-ssl source given at https://github.com/eighthave/openssl-android to build a library which can be used in android project.

按照在README.txt中的指示,我可以编译它的Andr​​oid平台版本2.2(级-8)

As per instructions given at README.txt, I am able to compile it for the the Android platform version 2.2 (level -8)

但我的应用程序需要它是2.1(级-7)兼容。

But my app requires it to be 2.1 (level -7) compatible.

我试图在与default.properties文件选项(<一href="https://github.com/eighthave/openssl-android/blob/master/default.properties">https://github.com/eighthave/openssl-android/blob/master/default.properties )

I tried following options with the default.properties file ( https://github.com/eighthave/openssl-android/blob/master/default.properties )

1)设定的目标=机器人-7

1) set target=android-7

2)设定的目标=机器人-5

2) set target=android-5

但是,当我编译使用命令NDK建造它,它提供了以下错误

But when I compile it using command ndk-build, it gives following error

    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

作为每个错误MESSAGE-Dl_info没有定义。但如果我们去到文件dso_dlfcn.c,已经提供了结构的定义。 (https://github.com/eighthave/openssl-android/blob/master/crypto/dso/dso_dlfcn.c)

As per error message- Dl_info is not defined. but if we go to file dso_dlfcn.c , the definition for the structure is already provided. (https://github.com/eighthave/openssl-android/blob/master/crypto/dso/dso_dlfcn.c)

和在默认属性编译为目标= Android的这8 code文件,而不是Android的7或Android-5。

And this code compiled for target=android-8 in default properties file, but not for android-7 or android-5.

请大家帮我解决这个错误。并让我知道所有的改变必须以编译为Android 2.1系统平台做了什么。

Request you to help me to resolve this error. and let me know what all changes needs to be done in order to compile it for android 2.1 platform.

在此先感谢。

推荐答案

尝试包括下面这段code到dso_dlfcn.c:

Try to include the following piece of code into 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

这是在我的案件库建成后。

After that in my case the library is built.

这篇关于构建Android-OpenSSL库为平台2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆