Skip to content Skip to sidebar Skip to footer

Compiling Openssl On Android

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 ge

Solution 1:

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

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

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.

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

APP_LDFLAGS := -latomic -lssl -lcrypto

Post a Comment for "Compiling Openssl On Android"