问题描述
使用Android NDK Clang编译器(r16b)编译FFMPEG源时,出现编译器错误.
while compiling FFMPEG source with Android NDK Clang compiler (r16b), I'm getting compiler error.
用于以下配置:
./configure \
--prefix=/home/prasaathviki/Desktop/ffmpeg/bin/android/26/arm64_26 \
--cross-
prefix=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android- \
--sysroot="/home/prasaathviki/Desktop/depends/android/ndk/mytoolchains/r16b/arm64_26/sysroot" \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-symver \
--enable-shared \
--enable-protocol=concat \
--enable-protocol=file \
--enable-muxer=mp4 \
--enable-demuxer=mpegts \
--target-os=android \
--enable-decoder=h264 \
--enable-cross-compile \
--arch=arm \
--cpu=arm \
--toolchain=clang-usan \
--extra-cflags="-fPIE -fPIC -ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16" \
--extra-ldflags="-pie" \
--cc=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-clang \
--cxx=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-clang++ \
--ld=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-ld \
--as=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-clang \
--ar=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-ar \
--strip=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-strip
在ffbuild/Config.log中,我收到以下错误消息.
In ffbuild/Config.log i'm getting this below error..
/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-clang --sysroot=/home/prasaathviki/Desktop/depends/android/ndk/mytoolchains/r16b/arm64_26/sysroot -fsanitize=undefined -fPIE -fPIC -ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16 -mcpu=arm -c -o /tmp/ffconf.Hn6wyaNC/test.o /tmp/ffconf.Hn6wyaNC/test.c
clang50: error: the clang compiler does not support '-mcpu=arm'
C compiler test failed.
我也尝试了不使用--cpu标志,但是仍然报告了如下错误
Also i have tried without --cpu flag, but still it reported an error as below
/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-clang --sysroot=/home/prasaathviki/Desktop/depends/android/ndk/mytoolchains/r16b/arm64_26/sysroot -fsanitize=undefined -fPIE -fPIC -ffast-math -funroll-loops -mfloat-abi=softfp -mfpu=vfpv3-d16 -mcpu= -c -o /tmp/ffconf.gQNwoHgC/test.o /tmp/ffconf.gQNwoHgC/test.c
clang50: warning: joined argument expects additional value: '-mcpu=' [-Wunused-command-line-argument]
clang50: error: the clang compiler does not support '-mcpu='
C compiler test failed.
请帮助我解决此问题.谢谢.
Please help me to resolve this issue. Thanks.
推荐答案
--arch=arm \
--cpu=arm \
...
--cc=/home/prasaathviki/Desktop/ndk/mytoolchains/r16b/arm64_26/bin/aarch64-linux-android-clang \
...
您要配置一个arm64工具链,并告诉它构建arm32.使用arm-linux-androideabi工具链来构建arm32,使用aarch64-linux-android工具来构建arm64.
You're giving configure an arm64 toolchain and telling it to build arm32. Use the arm-linux-androideabi toolchain for building arm32 and aarch64-linux-android for building arm64.
这篇关于FFMPEG源代码编译因Android NDK Clang编译器(r16b)而失败,错误为"clang编译器不支持'-mcpu = arm'".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!