Android上的OpenSSL编译 [英] Compiling OpenSSL on Android

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

问题描述

目前,我正在试图让我的Cocos2D-X项目,通过SSL连接到我的服务器和我得到了它在iOS工作,没有很多的问题,但是在Android上我不能连得OpenSSL的编译..我已经在谷歌搜索了很多,但所有帖子要么保持改向我HTTPS相关的帖子(这这不,我没有使用任何方式形状HTTP或形成在这里,纯粹的OpenSSL),职位上如何在Java或岗位标准Android SDK刚刚有没有帮助都这样做。

I'm currently trying to get my Cocos2D-X project to connect to my server through SSL and I got it to work on iOS without a lot of issues, however on Android I'm not able to even get OpenSSL to compile.. I've searched on Google quite a lot but all posts either keep re-directing me to HTTPS related posts (which this is not, I'm not using HTTP in any way shape or form here, purely OpenSSL), posts on how to do it with the standard Android SDK in Java or posts which just aren't helpful at all.

有人能告诉我我该怎么编这个游戏的Andr​​oid版本,并把它连接到我的服务器?

Can someone please show me how I can compile the Android version of this game and get it to connect to my server?

推荐答案

靠近你遇到了一个问题。每一个Android操作系统的libssl拥有和libcrypto库,OpenSSL的一部分。但其中不包括在NDK使用它们。所以,你可以一点点复制修改NDK *所以从手机文件。

Had a problem close to your. Every Android OS has libssl and libcrypto libraries that part of OpenSSL. But them not included in NDK for using them. So you can a little bit modify your NDK by copying *so files from the phone.

$adb pull /system/lib/libssl.so /myndk/platforms/android-14/arch-arm/usr/lib

$adb pull /system/lib/libcrypto.so /myndk/platforms/android-14/arch-arm/usr/lib

在哪里/ myndk是路径的NDK,Android的14 - 您当前的平台。

where /myndk is path to your NDK, android-14 - your current platform

另外从OpenSSL的源复制* .h文件到/ myndk /平台/ Android的14 /弓臂的/ usr / include文件夹。
同时添加到该文件夹​​下一个文件 - OpenSSL的/ opensslconf.h(你可以发现它在互联网或从源代码的OpenSSL配置)
只需要在编译时这些文件。一旦编译您的应用将得到库从手机。

Also copy *.h files from openssl sources to /myndk/platforms/android-14/arch-arm/usr/include folder. Also add to this folder the next file - openssl/opensslconf.h (you could found it in internet or configure from source openssl) These files needed only at compile time. Once compiled your App will get the libraries from the phone.

另外不要忘了JNI / Application.mk文件中添加-lssl -lcrypto选项APP_LDFLAGS栏目

Also do not forget add -lssl -lcrypto options in jni/Application.mk file for APP_LDFLAGS section

APP_LDFLAGS := -latomic -lssl -lcrypto

这篇关于Android上的OpenSSL编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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