我在一台macOS Catalina 10.15.1的机器上,源码编译ffmpeg,生成的ffmpeg和ffprobe等所有可执行程序都无法正常运行。一运行就报段错误崩溃。就像这样:
1 | ./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,对应的崩溃信息,大家如果遇到同样的问题,也可以调起来确定下是不是这个原因引起的。
1 | lldb $(which ffmpeg) |
本文完,作者yoko,尊重劳动人民成果,转载请注明原文出处: https://pengrl.com/p/20042/