#! /bin/bash
NDK_ROOT=/home/wanghy/tools/android-ndk-r17c
TOOL_ROOT=$NDK_ROOT/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
FLAGS="-isystem $NDK_ROOT/sysroot/usr/include/aarch64-linux-android -D__ANDROID_API__=28 -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wformat -Werror=format-security -O0 -fPIC"
INCLUDES=" -isystem $NDK_ROOT/sources/android/support/include"
PREFIX=./android/arm64
./configure \
--prefix=$PREFIX \
--enable-small \
--disable-programs \
--disable-avdevice \
--disable-encoders \
--disable-muxers \
--disable-filters \
--enable-cross-compile \
--cross-prefix=$TOOL_ROOT/bin/aarch64-linux-android- \
--disable-shared \
--enable-static \
--sysroot=$NDK_ROOT/platforms/android-28/arch-arm64 \
--extra-cflags="$FLAGS $INCLUDES" \
--extra-cflags="-isysroot $NDK_ROOT/sysroot/" \
--arch=arm64 \
--target-os=android
make clean
make install
如果报make:not found,可以通过apt install make 进行安装
以上编译通过的环境为:
系统:Ubuntu20.04.3 LTS FFmpeg:ffmpeg-4.0.2 NDK:android-ndk-r17c