macOS Catalina 10.15.1环境下编译的ffmpeg无法运行,启动就崩溃
我在一台 macOS Catalina 10.15.1
的机器上,源码编译ffmpeg,生成的ffmpeg和ffprobe等所有可执行程序都无法正常运行。一运行就报段错误崩溃。就像这样:
$./ffmpeg [1] 13651 segmentation fault ./ffmpeg
即使是 ./configure
时不加任何参数也不行。
这已经是我第无数次被这个 macOS 10.15
新版本系统坑了。。
在这个 帖子 的末尾,提供了解决方案,在 ./configure
加上 --extra-cflags="-fno-stack-check"
即可,帖子的原文内容如下:
It seems the 10.15 toolchain turns on “-fstack-check” by default for Clang, like some Linux distributions do. You can see that here :
Stack checking is on by default on all platforms to prevent memory corruptions. (25859140)
Some discussion here traces it back to AVX, although turning off AVX (“–disable-avx”) didn’t seem to help building FFMPEG. (Nor, as skyzyx saw above, did turning off ASM entirely.)
Accordingly, adding “-fno-stack-check” to “CFLAGS” – f.ex., by ‘–extra-cflags=”-fno-stack-check”‘ when configuring works around the problem and builds a functioning FFMPEG.
Don’t quite know what that means for us. I imagine having stack checking on is desirable, but there’s at least a workaround while the source is further investigated.
另外帖子中也有关于用lldb调试ffmpeg,对应的崩溃信息,大家如果遇到同样的问题,也可以调起来确定下是不是这个原因引起的。
$ lldb $(which ffmpeg) (lldb) target create "/usr/local/bin/ffmpeg" Current executable set to '/usr/local/bin/ffmpeg' (x86_64). (lldb) run Process 95311 launched: '/usr/local/bin/ffmpeg' (x86_64) Process 95311 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x00007fff6e08c366 libdyld.dylib`stack_not_16_byte_aligned_error libdyld.dylib`stack_not_16_byte_aligned_error: -> 0x7fff6e08c366 : movdqa %xmm0, (%rsp) 0x7fff6e08c36b : int3 0x7fff6e08c36c : nop 0x7fff6e08c36d : nop Target 0: (ffmpeg) stopped. (lldb) run --help There is a running process, kill it and restart?: [Y/n] y Process 95311 exited with status = 9 (0x00000009) Process 95317 launched: '/usr/local/bin/ffmpeg' (x86_64) Process 95317 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x00007fff6e08c366 libdyld.dylib`stack_not_16_byte_aligned_error libdyld.dylib`stack_not_16_byte_aligned_error: -> 0x7fff6e08c366 : movdqa %xmm0, (%rsp) 0x7fff6e08c36b : int3 0x7fff6e08c36c : nop 0x7fff6e08c36d : nop Target 0: (ffmpeg) stopped.
原文链接: https://pengrl.com/p/20042/
原文出处: yoko blog ( https://pengrl.com )
原文作者: yoko ( https://github.com/q191201771 )
版权声明:本文欢迎任何形式转载,转载时完整保留本声明信息(包含原文链接、原文出处、原文作者、版权声明)即可。本文后续所有修改都会第一时间在原始地址更新。