openssl NDK 交叉编译

栏目: 服务器 · 发布时间: 7年前

内容简介:openssl NDK 交叉编译

移植openssl到android

创建工作目录,并进入

mkdir android
cd android

下载源码

wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
tar xfz openssl-1.1.0e.tar.gz

生成交叉编译 工具

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --arch=arm --install-dir=./toolchain

导出环境变量(armeabi)

export ANDROID_HOME=`pwd`
export TOOLCHAIN=$ANDROID_HOME/toolchain
export CROSS_SYSROOT=$TOOLCHAIN/sysroot
export PATH=$TOOLCHAIN/bin:$PATH
export TOOL=arm-linux-androideabi
export CC=$TOOLCHAIN/bin/${TOOL}-gcc
export CXX=$TOOLCHAIN/bin/${TOOL}-g++
export LINK=${CXX}
export LD=$TOOLCHAIN/bin/${TOOL}-ld
export AR=$TOOLCHAIN/bin/${TOOL}-ar
export RANLIB=$TOOLCHAIN/bin/${TOOL}-ranlib
export STRIP=$TOOLCHAIN/bin/${TOOL}-strip
export ARCH_FLAGS="-mthumb"
export ARCH_LINK=
export CFLAGS="${ARCH_FLAGS}-fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64"
export CXXFLAGS="${CFLAGS}-frtti -fexceptions"
export LDFLAGS="${ARCH_LINK}"

编译并安装

cd openssl-1.1.0e/
./Configure android \
          --prefix=$TOOLCHAIN/sysroot/usr/local \
          --with-zlib-include=$TOOLCHAIN/sysroot/usr/include \
          --with-zlib-lib=$TOOLCHAIN/sysroot/usr/lib \
          zlib \
          no-asm \
          no-shared \
          no-unit-test
make -j4
make install

armeabi-v7a

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --arch=arm --install-dir=./toolchain
export TOOL=arm-linux-androideabi
export ARCH_FLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
export ARCH_LINK="-march=armv7-a -Wl,--fix-cortex-a8"

./Configure android-armv7 \
          --prefix=$TOOLCHAIN/sysroot/usr/local \
          --with-zlib-include=$TOOLCHAIN/sysroot/usr/include \
          --with-zlib-lib=$TOOLCHAIN/sysroot/usr/lib \
          zlib \
          no-asm \
          no-shared \
          no-unit-test

x86

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --arch=x86 --install-dir=./toolchain
export TOOL=x86-linux-android
export ARCH_FLAGS="-march=i686 -msse3 -mstackrealign -mfpmath=sse"
export ARCH_LINK=""

./Configure android-x86 \
          --prefix=$TOOLCHAIN/sysroot/usr/local \
          --with-zlib-include=$TOOLCHAIN/sysroot/usr/include \
          --with-zlib-lib=$TOOLCHAIN/sysroot/usr/lib \
          zlib \
          no-asm \
          no-shared \
          no-unit-test

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Geometric Folding Algorithms

Geometric Folding Algorithms

Erik D Demaine / Cambridge University Press / 2008-8-21 / GBP 35.99

Did you know that any straight-line drawing on paper can be folded so that the complete drawing can be cut out with one straight scissors cut? That there is a planar linkage that can trace out any alg......一起来看看 《Geometric Folding Algorithms》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具