(转)Android NDK编译Openssl-1.1.0f静态库

https://blog.csdn.net/ljttianqin/article/details/72991869

0 前言
按照源代码C:\openssl-1.1.0f下的INSTALL文件中的编译指导,在Windows中用Cygwin模拟Linux环境顺利编译出libcrypt.a和libssl.a,然而在Android NDK项目中编译报错不通过,报错无法解析的符号,检查.a静态库链接是正确的,所以推测用Cygwin编译出的.a库在windows下的android ndk下不能用。具体原因不清楚。所以,另想他法。
网上搜索到github上有一个开源项目,已经为编译openssl建好了工程。地址:https://github.com/guardianproject/openssl-android 。但是这个编译出来的库版本是1.0.0a,然而,作为追新族,就想着要最新版本1.1.0f的库,而且最新版本作过了很多更改和优化,所以就更想动手编译出最新版本的了。So, do it !

1 编译
编译环境:
win10 + eclipse + ndk13r

工程中可以编译出三个版本的Openssl静态库:openssl-1.0.0a、openssl-1.0.2k、openssl-1.1.2f,只需要修改jni目录下的Android.mk文件中的对应OPENSSL_PATH := $(LOCAL_PATH)/libs即可。
另外,在jni文件夹下,写了一个.bat批处理命令,直接双击OpensslBuild.bat文件即也可生成对应版本的静态库。
工程结构:

代码下载地址:
http://download.csdn.net/detail/ljttianqin/9872412

参考文献:

1. https://github.com/guardianproject/openssl-android

猜你喜欢

转载自blog.csdn.net/zyb418/article/details/84677260