编译环境
我使用的ndk版本为android-ndk-r16b,具体的可以看《NDK交叉编译OPENSSL编译环境Linux x86_64》中的安装NDK
步骤
下载pcre
cd /home
wget https://sourceforge.net/projects/pcre/files/pcre/8.44/pcre-8.44.tar.gz
tar -xf pcre-8.44.tar.gz
cd pcre-8.44
配置pcre
vim myconfig
#!/bin/sh
CFLAGS="-D__ANDROID_API__=21 --sysroot=/usr/local/android-ndk-r16b/platforms/android-21/arch-arm -isystem /usr/local/android-ndk-r16b/sysroot/usr/include -isystem /usr/local/android-ndk-r16b/sysroot/usr/include/arm-linux-androideabi"
./configure --prefix=/system --host=arm-linux-androideabi \
CFLAGS="$CFLAGS" \
CXXFLAGS="$CFLAGS" \
CPPFLAGS="-I/usr/local/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -I/usr/local/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include" \
LDFLAGS="-pie --sysroot=/usr/local/android-ndk-r16b/platforms/android-21/arch-arm -L/usr/local/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -lgnustl_static -lsupc++"
编译pcre
chmod +x myconfig
./myconfig
make&&make install
安装
将编译好的文件复制到android下的/system
路径即可