Working build scripts for OpenSSL libcrypto
and libssl
static and dynamic libraries primarily for using on Android. Mac, and Linux build script are kept and updated as well. Windows version removed from current repo, look to original one for the instructions.
This repo took best workable ideas from ekke/android-openssl-qt and couchbaselabs/couchbase-lite-libcrypto repos - many thanks to their authors! More ideas about these scripts creation could be found there. Resulting scripts successfully do all for you from downloading and extracting openssl and generating libs for x86
, armeabi-v7a
, arm64-v8a
architectures.
Default OpenSSL version is 1.0.2o as currently used in Qt Creator.
$ git clone https://github.com/akontsevich/openssl-android-build.git
$ export OPENSSL_VERSION="openssl-1.0.2o"
Run the following command on a Mac
$ ./generate-headers-mac.sh
or Linux machine:
$ ./generate-headers.sh
The headers will be output at libs/include
.
- Download Android NDK
Note. You need to download FULL NDK version as Android Studio ships reduced version which may cause build failure.
- Mac OSX or Linux Machine
- Make sure that you have the
ANDROID_NDK_HOME
variable defined. For example,
#.bashrc:
export ANDROID_NDK_HOME=~/Android/android-ndk-r10e
or
#.bashrc:
export ANDROID_NDK_HOME=~/Android/android-ndk-r18b
- Run the build script. The binaries will be output at
libs/android
$ ./build-android.sh
- Run the build script. The binaries will be output at
libs/android/clang
Note. More modern NDK version recommended to use there:
export ANDROID_NDK_HOME=~/Android/android-ndk-r18b
$ ./build-android-clang.sh
- Downdload and install Emscripten: http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
- Enter into
emsdk
dir and activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh
- Run the build script. The binaries will be output at
libs/wasm
$ ./build-emscripten.sh
- XCode
- makedepend (if you don't have one)
$ homebrew install makedepend
or
$ brew install makedepend
Run the build script. The binaries will be output at libs/osx
and libs/ios
. The osx and ios binaries are universal libraries.
$ ./build-osx-ios.sh
- GCC
- makedepend (if you don't have one) On Ubuntu:
$ sudo apt-get install xutils-dev
In openSUSE:
$ sudo zypper in makedepend
Run the build script. The binaries will be output at libs/linux
.
$ ./build-linux.sh
Modify .pro
file in a Qt project: insert this line into your .pro
:
include(android-build.pri)
Assume build libraries and headers copied to ./3rdparty
dir or your source tree. Following structure considers we build clang
library version:
$$PWD/3rdparty
└── include
└── openssl
└── *.h
└── libs/llvm
├── arm64-v8a
│ ├── libcrypto.a
│ ├── libcrypto.so
│ ├── libssl.a
│ └── libssl.so
├── arch-armeabi-v7a
│ ├── libcrypto.a
│ ├── libcrypto.so
│ ├── libssl.a
│ └── libssl.so
└── arch-x86
├── libcrypto.a
├── libcrypto.so
├── libssl.a
└── libssl.so
android {
INCLUDEPATH += $$absolute_path($$PWD/3rdparty/include)
equals(ANDROID_TARGET_ARCH, arm64-v8a) {
LIBPATH = $$absolute_path($$PWD/3rdparty/libs/llvm/arm64-v8a)
}
equals(ANDROID_TARGET_ARCH, armeabi-v7a) {
LIBPATH = $$absolute_path($$PWD/3rdparty/libs/llvm/armeabi-v7a)
}
LIBS += \
-L$$LIBPATH \
-lssl -lcrypto
ANDROID_EXTRA_LIBS += \
$$LIBPATH/libssl.so \
$$LIBPATH/libcrypto.so
}