[英]Compile OpenSSL 1.1.0 for Android
I'm trying to compile openssl-1.1.0 on Android by cygwin follow by this guidance: 我正在尝试通过cygwin在Android上编译openssl-1.1.0,并遵循以下指导:
Compiling the latest OpenSSL for Android 编译最新的Android版OpenSSL
But it's failed, this is the error : 但这失败了,这是错误:
crypto/aes/aes_ecb.c:10:20: fatal error: assert.h: No such file or directory
#include <assert.h>
I'm using Android-ndk-r12b, Win10, cygwin 64 bit. 我正在使用Android-ndk-r12b,Win10,cygwin 64位。
This is my pre-config before compiling: 这是我在编译之前的预配置:
export NDK=~/android-ndk-r12b
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-21 --toolchain=arm-linux-androideabi-4.9 --install-dir=`pwd`/android-toolchain-arm
export TOOLCHAIN_PATH=`pwd`/android-toolchain-arm/bin
export TOOL=arm-linux-androideabi
export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
export CC=$NDK_TOOLCHAIN_BASENAME-gcc
export CXX=$NDK_TOOLCHAIN_BASENAME-g++
export LINK=${CXX}
export LD=$NDK_TOOLCHAIN_BASENAME-ld
export AR=$NDK_TOOLCHAIN_BASENAME-ar
export RANLIB=$NDK_TOOLCHAIN_BASENAME-ranlib
export STRIP=$NDK_TOOLCHAIN_BASENAME-strip
export ARCH_FLAGS="-mthumb"
export ARCH_LINK=
export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
export LDFLAGS=" ${ARCH_LINK} "
./Configure android
PATH=$TOOLCHAIN_PATH:$PATH make
Please help to tell me where I'm wrong 请帮我告诉我哪里错了
EDIT: 编辑:
Follow by jww's suggestion, I try with https://wiki.openssl.org/index.php/Android 按照jww的建议,我尝试使用https://wiki.openssl.org/index.php/Android
I changed some config in setenv-android.sh into: 我将setenv-android.sh中的一些配置更改为:
-_ANDROID_NDK="android-ndk-r12b"
-_ANDROID_EABI="arm-linux-androideabi-4.9"
-_ANDROID_API="android-21"
To generate valid toolchains, I add "windows-x86_64" into for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86" Now it's: 为了生成有效的工具链,我将“ windows-x86_64”添加到“ linux-x86_64”,“ linux-x86”,“ darwin-x86_64”,“ darwin-x86”中作为主机的位置:
for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86" "windows-x86_64"
do
....
done
+Build openssl-1.1.0: +建立openssl-1.1.0:
Error: 错误:
$ perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
Can't open Makefile.org: No such file or directory.
EDIT 2: 编辑2:
I follow the wiki update by jww and it runs smoothly until this command: 我遵循jww的wiki更新,它运行平稳,直到执行以下命令:
arm-linux-androideabi-gcc -I /usr/local/ssl/include my_prog.c -o my_prog.exe -L /usr/local/ssl/lib -lssl -lcrypto
If I use $ANDROID_TOOCHAIN/arm-linux-androideabi-gcc -I /usr/local/ssl/include my_prog.c -o my_prog.exe -L /usr/local/ssl/lib -lssl -lcrypto
, it doesn't understand -I
and my_prog.c
如果我使用
$ANDROID_TOOCHAIN/arm-linux-androideabi-gcc -I /usr/local/ssl/include my_prog.c -o my_prog.exe -L /usr/local/ssl/lib -lssl -lcrypto
,则不会了解-I
和my_prog.c
I want to build openssl-1.1.0 for android but I don't know how to fix it. 我想为Android构建openssl-1.1.0,但我不知道如何解决。 Please help
请帮忙
I was trying to build OpenSSL 1.1.0g for Android with 我正在尝试为Android构建OpenSSL 1.1.0g
android NDK android-ndk-r16b, centOS 6.9 64 bit OS.
as per https://wiki.openssl.org/index.php/Android 按照https://wiki.openssl.org/index.php/Android
and had the same problem 并有同样的问题
crypto/aes/aes_ecb.c:10:20: fatal error: assert.h: No such file or directory
#include <assert.h>
After searching, I found that Updated NDK android-ndk-r16b
has updated the sysroot
to android-ndk-r16b/sysroot
which contains the include directories but no library. 搜索后,我发现,更新NDK
android-ndk-r16b
已更新sysroot
到android-ndk-r16b/sysroot
其中包含了包括目录,但没有图书馆。
So the include path and the library path has changed 因此包含路径和库路径已更改
but the setenv-android.sh
set the sysroot
as 但
setenv-android.sh
设置sysroot
为
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
But this is valid for android-ndk-r13b 但这对android-ndk-r13b有效
I can successfully build the OpenSSL with android-ndk-r13b. 我可以使用android-ndk-r13b成功构建OpenSSL。
Please take a look at this Github library 请看一下这个Github库
setenv-android.sh
is not necessary. setenv-android.sh
。 This really works. 这确实有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.