最近将mac本的系统升级为macOS10.15,xcode升级为11,回头发现重新编译出来的ffmpeg运行时会崩溃,而之前编译的运行没有问题。
现象:
./configure
make
编译成功后,执行./ffmpeg,出现crash
[1] 85565 segmentation fault ./ffmpeg
调试信息
ffmpeg git:(master) lldb ffmpeg_g
(lldb) target create "ffmpeg_g"
Current executable set to 'ffmpeg_g' (x86_64).
(lldb) r
Process 85587 launched: '/Users/mayudong/code/ffmpeg/ffmpeg_g' (x86_64)
Process 85587 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x00007fff70a12476 libdyld.dylib`stack_not_16_byte_aligned_error
libdyld.dylib`stack_not_16_byte_aligned_error:
-> 0x7fff70a12476 <+0>: movdqa %xmm0, (%rsp)
0x7fff70a1247b <+5>: int3
0x7fff70a1247c <+6>: nop
0x7fff70a1247d <+7>: nop
Target 0: (ffmpeg_g) stopped.
(lldb)
解决方案
执行configure时增加--extra-cflags="-fno-stack-check"参数
原因是xcode11升级时将clang默认打开了-fstack-check
参考:https://trac.ffmpeg.org/ticket/8073