diff options
author | Adam Langley <agl@google.com> | 2015-04-29 03:46:58 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-05-05 03:31:46 +0300 |
commit | 843ab66e17abd347546480df77b5140c5b7f50bd (patch) | |
tree | a58bb22a6571929c047643bc3c712fdeb1f7aba9 /BUILDING | |
parent | f868409124747fba1b3ec070c0a5a7821cdb4649 (diff) |
Add support for building with the Android NDK.
Previously I've been using the Linaro toolchains and just building
static binaries. However, the Linaro toolchains have a broken
pthread_rwlock_wrlock—it does nothing and then unlocking corrupts the
lock.
Building with the Android NDK avoids this.
These build instructions depend on
https://github.com/taka-no-me/android-cmake which people will need to
clone into util/ if they want to use the Android NDK.
Change-Id: Ic64919f9399af2a57e8df4fb4b3400865ddb2427
Reviewed-on: https://boringssl-review.googlesource.com/4600
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'BUILDING')
-rw-r--r-- | BUILDING | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -43,17 +43,37 @@ automatically. Note that the default build flags in the top-level CMakeLists.txt are for debugging - optimisation isn't enabled. -If you want to cross-compile then there are example toolchain files for 32-bit -Intel and ARM in util/. Wipe out the build directory, recreate it and run cmake +If you want to cross-compile then there is an example toolchain file for +32-bit Intel in util/. Wipe out the build directory, recreate it and run cmake like this: - cmake -DCMAKE_TOOLCHAIN_FILE=../util/arm-toolchain.cmake -GNinja .. + cmake -DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake -GNinja .. If you want to build as a shared library, pass -DBUILD_SHARED_LIBS=1. On Windows, where functions need to be tagged with "dllimport" when coming from a shared library, define BORINGSSL_SHARED_LIBRARY in any code which #includes the BoringSSL headers. + +Building for Android: + +It's possible to build BoringSSL with the Android NDK using CMake. This has +been tested with version 10d of the NDK. + +Unpack the Android NDK somewhere and export ANDROID_NDK to point to the +directory. Clone https://github.com/taka-no-me/android-cmake into util/. +Then make a build directory as above and run CMake *twice* like this: + + cmake -DANDROID_NATIVE_API_LEVEL=android-9 \ + -DANDROID_ABI=armeabi-v7a \ + -DCMAKE_TOOLCHAIN_FILE=../util/android-cmake/android.toolchain.cmake \ + -GNinja .. + +Once you've run that twice, ninja should produce Android-compatible binaries. +You can replace "armeabi-v7a" in the above with "arm64-v8a" to build aarch64 +binaries. + + Known Limitations on Windows: * Versions of cmake since 3.0.2 have a bug in its Ninja generator that causes |