Reputation: 2729
I am working on an application which uses the OpenSSL library. I am trying to run the app on Android emulator without replacing the OpenSSL by boringssl. So I downloaded the AOSP source tree and I am currently able to lunch emulator.
To add OpenSSL, I git clone the openssl
into external/openssl
.
Based on the openssl project http://github.com/eighthave/openssl-android I added different Android.mk files in the external/openssl, external/openssl/apps, external/openssl/crypto and external/openssl/ssl folder, added android-config.mk, and Application.mk to external/openssl folder. But when I run mm, the compiler spits an error:
build/core/base_rules.mk:217: *** external/openssl/crypto: MODULE.TARGET.SHARED_LIBRARIES.libcrypto already defined by external/boringssl.
build/core/ninja.mk:155: recipe for target 'out/build-aosp_arm-mmm-external_openssl_Android.mk.ninja' failed
make: *** [out/build-aosp_arm-mmm-external_openssl_Android.mk.ninja] Error 1
make: Leaving directory '/home/rong/projects/Android/src'
Any one knows how to build OpenSSL in AOSP?
AOSP environment:
Development environment:
Upvotes: 2
Views: 1545
Reputation: 1837
Follow these instructions may help :)
Download Android NDK (version ndk-r13b) from this url:
https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
Extract NDK to /home/Android.
Download the cross compilation setup script from this URL:
Make following changes in the Setenv-android.sh script:
a: Add the following line to the start of the script:
ANDROID_NDK_ROOT=/home/Android/android-ndk-r13b
b: Modify _ANDROID_NDK="android-ndk-r13".
c: Modify _ANDROID_EABI="arm-linux-androideabi-4.9"
d: Modify _ANDROID_API="android-23"
Download the openssl (version 1.0.2n) from this url:
https://www.openssl.org/source/old/1.0.2/openssl-1.0.2n.tar.gz
Extract the downloaded tarball.
Open new terminal window and navigate to extracted directory.
Move the Setenv-android.sh script to this directory and execute the following commands:
chmod a+x Setenv-android.sh
source ./Setenv-android.sh
Run the following command (to configure OpenSSL sources to build for Android):
./Configure shared android
Execute following command to build libcrypto and libssl shared libraries.
make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" build_libs
Let the build complete successfully.
Upvotes: 1