Mac下编译x264 for Android
16lz
2021-01-26
前言
在编译之前建议先去了解交叉编辑环境生成教程,后续编译基于此。
自定义NDK交叉编译链(toolchain)
环境
操作系统:mac os 10.14.2
ndk版本:android-ndk-r20
libx264: x264-snapshot-20191211-2245
脚本
- 下载x264
- 进入下载后的x264目录,创建build_android.sh
#!/bin/shNDK_HOME=~/Library/Android/sdk/ndk-bundle#自定义NDK toolchain目录CHAIN_ENV=${NDK_HOME}/Chain/android-toolchain#ARCH=arm64ANDROID_ARCH=arm# All the built binaries, libs and their header will be installed herePREFIX=~# static or share libs dirOUT_PUT=${PREFIX}/android-output# The cross-compile toolchain we useTOOLCHAIN=${ANDROID_ARCH}-linux-androideabi# The path of standalone NDK toolchain# Refer to https://developer.android.com/ndk/guides/standalone_toolchain.htmlNDK_TOOLCHAIN=${CHAIN_ENV}/${ANDROID_ARCH}# Set Android Sysroot according to API and archSYSROOT=${NDK_TOOLCHAIN}/sysrootARM_LIB=$SYSROOT/usr/lib# Binutils pathCROSS_PREFIX=${NDK_TOOLCHAIN}/bin/${TOOLCHAIN}./configure \ --prefix=${OUT_PUT}/libx264/${ANDROID_ARCH} \ --cross-prefix=${CROSS_PREFIX}- \ --sysroot=$SYSROOT \ --enable-static \ --enable-pic \ --disable-asm \ --host=arm-linux \make cleanmake install
- 添加执行权相执行脚本
结果
更多相关文章
- OMG,终于解决了IntelliJ IDEA配合Android和gradle时出现Unsupport
- android studio编译警告:请使用 -Xlint:deprecation 重新编译
- Android中实现图文并茂的按钮实例代码
- 解决Android在MAC OSX上编译缺少10.5SDK问题
- 编译Coco2d-x android 程序出现make: *** No rule to make targe
- Ubuntu13.04环境下载、编译Android源代码
- 闲来无事,塔建了一下android ndk和简单的编译并安装运行apk
- [cocos2dx] cocosdx编译工程那些事
- [笔记]如何解决Your project contains C++ files but it is not