目录
编译 LIBXML2 (android-21-armeabi-v7a)
编译LIBXML2 arm64位 (android-21-arm64-v8a)
参考:https://github.com/djp952/prebuilt-libxml2/blob/master/README.md
编译环境
- Windows 10 x64 20H2 (19042)
- Windows Subsystem for Linux (WSL v1 recommended)
- WSL Ubuntu 18.04 LTS Distro
必须配置的依赖
- 打开WSL "Ubuntu 18.04 LTS"
sudo dpkg --add-architecture i386
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main universe'
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9 libc6-dev:i386 libstdc++-4.9-dev:i386 lib32gcc-4.9-dev
sudo apt-get install gcc-4.9-arm-linux-gnueabihf g++-4.9-arm-linux-gnueabihf gcc-4.9-arm-linux-gnueabi g++-4.9-arm-linux-gnueabi gcc-4.9-aarch64-linux-gnu g++-4.9-aarch64-linux-gnu
sudo apt-get install autoconf automake make libtool make p7zip-full python
配置Android编译工具链
- 如果已安装NDK,则可以跳过
wget https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip
7z x android-ndk-r20b-linux-x86_64.zip
编译 LIBXML2 (android-21-armeabi-v7a)
git clone https://gitlab.gnome.org/GNOME/libxml2 -b v2.9.11 --depth=1
export TOOLCHAIN=$(pwd)/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64
export AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
export AS=$TOOLCHAIN/bin/arm-linux-androideabi-as
export CC=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang
export CXX=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang++
export LD=$TOOLCHAIN/bin/arm-linux-androideabi-ld
export RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
export STRIP=$TOOLCHAIN/bin/arm-linux-androideabi-strip
export LIBS=-ldl
cd libxml2
./autogen.sh --host=arm-linux-androideabi --target=arm-linux-androideabi --with-pic --disable-shared --without-iconv --without-http --without-ftp --without-legacy --without-c14n --without-catalog --without-html --without-writer --without-schematron --without-docbook --without-output --without-push --without-modules --without-tree --without-xptr --without-xinclude --without-xpath --without-schemas --without-sax1 --without-iso8859x --without-python --without-zlib --without-lzma
make
头文件目录: include/libxml
libxml2.a 目录: .libs
编译LIBXML2 arm64位 (android-21-arm64-v8a)
git clone https://gitlab.gnome.org/GNOME/libxml2 -b v2.9.11 --depth=1
export TOOLCHAIN=$(pwd)/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64
export AR=$TOOLCHAIN/bin/aarch64-linux-android-ar
export AS=$TOOLCHAIN/bin/aarch64-linux-android-as
export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++
export LD=$TOOLCHAIN/bin/aarch64-linux-android-ld
export RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib
export STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip
export LIBS=-ldl
cd libxml2
./autogen.sh --host=aarch64-linux-android --target=aarch64-linux-android --with-pic --disable-shared --without-iconv --without-http --without-ftp --without-legacy --without-c14n --without-catalog --without-html --without-writer --without-schematron --without-docbook --without-output --without-push --without-modules --without-tree --without-xptr --without-xinclude --without-xpath --without-schemas --without-sax1 --without-iso8859x --without-python --without-zlib --without-lzma
make
头文件目录: include/libxml
libxml2.a 目录: .libs
原文:prebuilt-libxml2/README.md at master · djp952/prebuilt-libxml2 · GitHub