ffmpeg mac 编译没有问题, 但是Android交叉编译的时候,一直生成不了文件
环境: mac 10.13.6
ffmpeg: 4.1.3
NDK: android-ndk-r10e
ffmpeg version 4.1.git Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.10.44.4)
configuration: --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-videotoolbox --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --cc=clang --host-cflags= --host-ldflags=
libavutil 56. 28.100 / 56. 28.100
libavcodec 58. 52.102 / 58. 52.102
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 54.101 / 7. 54.101
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
Android 交叉编译脚本和运行命令如下,我查看了我文件对应的目录都有对应的文件,但是就是编译后,没有生成文件夹
执行命令:
sudo ./build_ffmpeg_for_android.sh
执行脚本:
PREFIX=android-build
#设置你自己的NDK位置
NDK_HOME=/Users/xxxx/Library/Android/sdk/android-ndk-r10e
#设置你自己的平台,这上Mac上的,linux换成linux-x86_64
NDK_HOST_PLATFORM=darwin-x86_64
COMMON_OPTIONS="\n --target-os=android \n --disable-static \n --enable-shared \n --enable-small \n --disable-programs \n --disable-ffmpeg \n --disable-ffplay \n --disable-ffprobe \n --disable-doc \n --disable-symver \n --disable-asm \n "
function build_android {
./configure \n --libdir=${PREFIX}/libs/armeabi-v7a \n --incdir=${PREFIX}/includes/armeabi-v7a \n --pkgconfigdir=${PREFIX}/pkgconfig/armeabi-v7a \n --arch=arm \n --cpu=armv7-a \n --cross-prefix="${NDK_HOME}/toolchains/arm-linux-androideabi-4.9/prebuilt/${NDK_HOST_PLATFORM}/bin/arm-linux-androideabi-" \n --sysroot="${NDK_HOME}/platforms/android-19/arch-arm/" \n --extra-cflags="-march=armv7-a -mfloat-abi=softfp -mfpu=neon" \n --extra-ldexeflags=-pie \n ${COMMON_OPTIONS}
make clean
make -j8 && make install
# ./configure \n # --libdir=${PREFIX}/libs/arm64-v8a \n # --incdir=${PREFIX}/includes/arm64-v8a \n # --pkgconfigdir=${PREFIX}/pkgconfig/arm64-v8a \n # --arch=aarch64 \n # --cpu=armv8-a \n # --cross-prefix="${NDK_HOME}/toolchains/aarch64-linux-android-4.9/prebuilt/${NDK_HOST_PLATFORM}/bin/aarch64-linux-android-" \n # --sysroot="${NDK_HOME}/platforms/android-21/arch-arm64/" \n # --extra-ldexeflags=-pie \n # ${COMMON_OPTIONS}
# make clean
# make -j8 && make install
# ./configure \n # --libdir=${PREFIX}/libs/x86 \n # --incdir=${PREFIX}/includes/x86 \n # --pkgconfigdir=${PREFIX}/pkgconfig/x86 \n # --arch=x86 \n # --cpu=i686 \n # --cross-prefix="${NDK_HOME}/toolchains/x86-4.9/prebuilt/${NDK_HOST_PLATFORM}/bin/i686-linux-android-" \n # --sysroot="${NDK_HOME}/platforms/android-19/arch-x86/" \n # --extra-ldexeflags=-pie \n # ${COMMON_OPTIONS}
# make clean
# make -j8 && make install
# ./configure \n # --libdir=${PREFIX}/libs/x86_64 \n # --incdir=${PREFIX}/includes/x86_64 \n # --pkgconfigdir=${PREFIX}/pkgconfig/x86_64 \n # --arch=x86_64 \n # --cpu=x86_64 \n # --cross-prefix="${NDK_HOME}/toolchains/x86_64-4.9/prebuilt/${NDK_HOST_PLATFORM}/bin/x86_64-linux-android-" \n # --sysroot="${NDK_HOME}/platforms/android-21/arch-x86_64/" \n # --extra-ldexeflags=-pie \n # ${COMMON_OPTIONS}
# make clean
# make -j8 && make install
};
build_android
w
错误日志:
/Users/xxxx/Library/Android/sdk/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-clang is unable to create an executable file.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
······
省略部分日志
······
ld: warning: text-based stub file /System/Library/Frameworks//VideoToolbox.framework/VideoToolbox.tbd and library file /System/Library/Frameworks//VideoToolbox.framework/VideoToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//VideoToolbox.framework/VideoToolbox.tbd and library file
INSTALL libavutil/rational.h
INSTALL libavutil/lzo.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/ffversion.h
INSTALL libavutil/libavutil.pc