Cross Build Libevent-2.1.10 for Andriod

Build Environment Prepare

If you wan to build libevent for andriod you shoud do two things. Frist you should get libevent source code, second you need to get NDK build environment.

Get Libevent-2.1.10 Source Code

Get Andriod NDK and Configure Environment Variable.

  • NDK cross build tools web site at:
    https://developer.android.google.cn/ndk/downloads/index.html
  • Set NDK Environment Variable
    export NDK_HOME=/home/heyongxin/android-ndk-r16b
  • Openssl and libcrpto Note
    if you wan to use libevent_openssl.a, you need to set openssl include path in build scripts. My computer have make and install libevent in defaut path so i don’t need set it.

Writing the Build Scripts

Arm64-v8a and Armeabi-v7a chip arch hvave covered the most device in the market. so we only provide these two arch’s build script.

The Target Device for Arm64-v8a

#!/bin/sh
NDK=/home/heyongxin/android-ndk-r16b
LIBEVENT_TMP_FOLDER=$PWD
LIBEVENT_TARGET_API=android-23
LIBEVENT_GCC_VERSION=4.9
LIBEVENT_OUTPUT_PATH=$PWD/openssl_build
rm -rf $LIBEVENT_OUTPUT_PATH
mkdir -p $LIBEVENT_OUTPUT_PATH
mkdir -p $LIBEVENT_TMP_FOLDER/android-toolchain-aarch64
NDK_MAKE_TOOLCHAIN=$NDK/build/tools/make-standalone-toolchain.sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值