meh / rust-ffmpeg-sys

moved to meh/rust-ffmpeg
145 stars 87 forks source link

Build script failing on Windows with a stack overflow #94

Closed semicoleon closed 3 years ago

semicoleon commented 3 years ago

rustc 1.49.0 stable-x86_64-pc-windows-gnu Windows 10 19042.746

error: failed to run custom build command for `ffmpeg-sys v4.2.1

Caused by:
  process didn't exit successfully: `[...]\target\release\build\ffmpeg-sys-8f4a0330768df3c3\build-script-build` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)
  --- stderr

  thread 'main' has overflowed its stack

After digging around in std::sys for awhile, it seems like the main thread on Windows is getting a stack overflow guard with a (hardcoded) very low minimum stack size. Commenting out ~half of the .header(...) method calls causes the overflow to stop happening. Spawning a new thread with 3MiB of stack space and just waiting on it in main has resolved the issue for me.

Note: I'm linking to dynamic libraries, not having ffmpeg-sys build ffmpeg.