ffmpeg常见编译问题及其解决方案

前言

ffmpeg编译可以看ffbuild/config.log,里面有报错信息。很多问题都是configure配置引起的,可以输入./configure --help查看帮助

1.no such file or directory: '/temp/ffconf.tHz8vnGK/test.c'

test_cc
BEGIN /cygdrive/c/code/media/Android-Live/ffmpeg_src/fftemp/ffconf.tHz8vnGK/test.c
    1   int main(void){ return 0; }
END /cygdrive/c/code/media/Android-Live/ffmpeg_src/fftemp/ffconf.tHz8vnGK/test.c
C:/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi16-clang --sysroot=C:/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot -IC:/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include -mcpu=arm -c -o /cygdrive/c/code/media/Android-Live/ffmpeg_src/fftemp/ffconf.tHz8vnGK/test.o /cygdrive/c/code/media/Android-Live/ffmpeg_src/fftemp/ffconf.tHz8vnGK/test.c
clang: error: no such file or directory: '/cygdrive/c/code/media/Android-Live/ffmpeg_src/fftemp/ffconf.tHz8vnGK/test.c'
clang: error: no input files
C compiler test failed.

原因:cygwin环境运行的可执行程序不能识别/cygdrive这种路径,只能用windows系统路径

解决方案:在调用./configure之前,先设置TMPDIR环境变量,如:export TMPDIR=C:/ffmpeg/temp

2. libavutil/libavutil.so:1:1: syntax error, unexpected '!', expecting $end

build error:
LD libavutil/libavutil.so.55
LD libswscale/libswscale.so.4
f:/android/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: libavutil/libavutil.so:1:1: syntax error, unexpected '!', expecting $end
f:/android/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: libavutil/libavutil.so: not an object or archive
collect2.exe: error: ld returned 1 exit status
library.mak:111: recipe for target 'libswscale/libswscale.so.4' failed
make: *** [libswscale/libswscale.so.4] Error 1

原因:ffmpeg 4.0版本来时在编译过程中使用软连接命令,而链接器无法识别 cygwin 的软链接符号

解决方案:--ln_s="cp -rf" 来指定使用复制替代 "ln -s"

./configure \  
--ln_s="cp -rf" \
...

你可能感兴趣的:(ffmpeg常见编译问题及其解决方案)