Android NDK Cross-Compile Setup

按照这个文章来做就行了

http://mortoray.com/2012/08/21/android-ndk-cross-compile-setup-libpng-and-freetype/

分享一个脚本

#!/bin/sh

set -e

PLATFORM_PREFIX=/home/hoping/Downloads/geos-3.4.2/android
PATH=$PLATFORM_PREFIX/bin:$PATH
NDK_PLATFORM=android-9

if [ ! -e $PLATFORM_PREFIX ]; then
	mkdir $PLATFORM_PREFIX
fi
$NDK_ROOT/build/tools/make-standalone-toolchain.sh  --platform=$NDK_PLATFORM --install-dir=$PLATFORM_PREFIX --system=linux-x86_64

cp /usr/share/misc/config.* .

./configure --host=arm-linux-androideabi --prefix=$PLATFORM_PREFIX

make

make install

注意其中,cp config.*这一句,这是为了更新当前脚本所使用的config.xxx文件,否则可能会报host not found错误

PKG_CONFIG_PATH="/home/chang/dev/mpp/mpp_build/install/usr/local/lib/pkgconfig" ./configure --target-os=android --arch=aarch64 --prefix=/home/chang/dev/ffmpeg-rockchip/rk3576 --enable-cross-compile --cross-prefix=$TOOLCHAIN/bin/llvm- --sysroot=/opt/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot --cc=$TOOLCHAIN/bin/${TARGET}-clang --cxx=$TOOLCHAIN/bin/${TARGET}-clang++ --enable-rkmpp --enable-libdrm --enable-shared --enable-version3 --disable-static --disable-doc --disable-programs --pkg-config=/home/chang/dev/mpp/mpp_build/install/usr/local/lib/pkgconfig ERROR: libdrm not found using pkg-config 出现这个问题为什么?这是日志/opt/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang --sysroot=/opt/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -std=c11 -fPIE -fomit-frame-pointer -fPIC -pthread -c -o /tmp/ffconf.MDjIb8zP/test.o /tmp/ffconf.MDjIb8zP/test.c /tmp/ffconf.MDjIb8zP/test.c:3:24: warning: cast to smaller integer type 'int' from 'float (*)(float, float)' [-Wpointer-to-int-cast] int main(void){ return (int) foo; } ^~~~~~~~~ 1 warning generated. /opt/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang --sysroot=/opt/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Wl,--as-needed -Wl,-z,noexecstack -fPIE -pie -o /tmp/ffconf.MDjIb8zP/test /tmp/ffconf.MDjIb8zP/test.o -lm require_pkg_config libdrm libdrm xf86drm.h drmGetVersion check_pkg_config libdrm libdrm xf86drm.h drmGetVersion test_pkg_config libdrm libdrm xf86drm.h drmGetVersion false --exists --print-errors libdrm ERROR: libdrm not found using pkg-config
最新发布
03-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值