CURL编译

安卓

NDK android-ndk-r14b(高版本不能通过)

zlib-1.2.11.tar.gz

curl-7.65.3.tar.gz

openssl-1.1.1a.tar.gz

zlib编译

export NDK_HOME=/usr/NDK/android-ndk-r14b
export BASE=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
export CURL_PATH=/var/android/curl
export OPENSSL_PATH=/var/android/openssl/
export ZLIB_PATH=/var/android/zlib/

export SYSROOT=$NDK_HOME/platforms/android-21/arch-arm
export CFLAGS="--sysroot=${SYSROOT}"
export CPPFLAGS="$CPPFLAGS -I${SYSROOT}/usr/include"
export CC=$BASE/arm-linux-androideabi-gcc
export CPP=$BASE/arm-linux-androideabi-cpp
export CXX=$BASE/arm-linux-androideabi-g++
export LD=$BASE/arm-linux-androideabi-ld
export AS=$BASE/arm-linux-androideabi-as
export AR=$BASE/arm-linux-androideabi-ar
export NM=$BASE/arm-linux-androideabi-nm
export STRIP=$BASE/arm-linux-androideabi-strip
export RANLIB=$BASE/arm-linux-androideabi-ranlib
export PATH=$PATH:$BASE
export PKG_CONFIG_PATH="$CURL_BUILD_DIR/zlib/pkgconfig"
../configure --static --prefix=$ZLIB_BUILD_DIR

openssl编译(编译了很多次都失败了必须用ndk14以下,必须在openssl源码目录编译否则会出错)

export ANDROID_NDK=/usr/NDK/android-ndk-r14b
export PATH=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
./Configure android-arm -D__ANDROID_API__=21 --prefix=/var/android/opensslback

curl编译

export NDK_HOME=/usr/NDK/android-ndk-r14b
export BASE=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin
export CURL_PATH=/var/android/curl
export OPENSSL_PATH=/var/android/openssl/
export ZLIB_PATH=/var/android/zlib/

export SYSROOT=$NDK_HOME/platforms/android-21/arch-arm
export CFLAGS="--sysroot=${SYSROOT}"
export CPPFLAGS="$CPPFLAGS -I${SYSROOT}/usr/include"
export CC=$BASE/arm-linux-androideabi-gcc
export CPP=$BASE/arm-linux-androideabi-cpp
export CXX=$BASE/arm-linux-androideabi-g++
export LD=$BASE/arm-linux-androideabi-ld
export AS=$BASE/arm-linux-androideabi-as
export AR=$BASE/arm-linux-androideabi-ar
export NM=$BASE/arm-linux-androideabi-nm
export STRIP=$BASE/arm-linux-androideabi-strip
export RANLIB=$BASE/arm-linux-androideabi-ranlib
export PATH=$PATH:$BASE
export PKG_CONFIG_PATH="$CURL_BUILD_DIR/openssl/pkgconfig"
../configure \
	--host=arm-linux-androideabi \
	CC=$CC AR=$AR LD=$LD NM=$NM STRIP=$STRIP CXX=$CXX CPPFLAGS=$CFLAGS LDFLAGS=$LDFLAGS \
	--enable-cross-compile \
	--enable-static \
	--enable-shared \
	--disable-verbose \
	--enable-threaded-resolver \
	--enable-libgcc \
	--enable-ipv6 \
	--with-ssl=$OPENSSL_PATH \
	--with-zlib=$ZLIB_PATH \
	--prefix=$CURL_PATH

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值