在linux上使用android ndk交叉编译openssl1.0.2常见问题
程序员文章站
2022-07-01 16:12:41
1. makedepend: not foundapt-get install xutils-dev2. target already defined - linux-x86_64 (offending arg: android-armv7)参考:https://wiki.openssl.org/index.php/Android打开文件: bipay/patches/openssl-android.shmkdir prebuilt/$1. ./openssl-android-env.sh...
1. makedepend: not found
apt-get install xutils-dev
2. target already defined - linux-x86_64 (offending arg: android-armv7)
参考:
https://wiki.openssl.org/index.php/Android
打开文件: bipay/patches/openssl-android.sh
mkdir prebuilt/$1
. ./openssl-android-env.sh -- 这里指定ABI的版本,在执行 ./config 命令时,无需要指定 $configure_platform
echo "CROSS COMPILE ENV : $CROSS_COMPILE"
xCFLAGS="-fPIC -DOPENSSL_PIC -DDSO_DLFCN -DHAVE_DLFCN_H -mandroid -I$ANDROID_DEV/include/$CROSS_INCLUDE -I$ANDROID_DEV/include -B$ANDROID_DEV/$xLIB -B$ANDROID_LIB/$xLIB -O3 -fomit-frame-pointer -Wall"
# perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
echo "OPENSSL INSTALL DIR:"$INSTALL_DIR
./config no-asm no-zlib no-ssl2 no-ssl3 no-comp no-hw no-engine --prefix=$INSTALL_DIR --openssldir=ssl $configure_platform $xCFLAGS
# patch SONAME
3. 无效编译选项: arm-linux-androideabiarm-linux-androideabi-clang
因为环境变量中,有NDK: android-ndk-r16b 和工具链: android-toolchain-23,如果都配置在环境变量中,openssl中的config命令可能会配置CC=arm-linux-androideabi-clang,导致编译出现问题。
本文地址:https://blog.csdn.net/JasBin2008/article/details/108584539