vtkIOFFMPEG-pv5.5.dll Fails to Link on Windows

For tomviz, when we try to build the master branch of ParaView on Windows (with FFMPEG enabled), linking fails with messages such as those pasted below. The full output of our build on buildbot can be seen here. We are building with VS 2015, and we are linking to the pre-built FFMPEG library found here. This worked for older versions of ParaView, but it looks like there are issues with 5.5.

[6/9933] Linking CXX shared library bin\vtkIOFFMPEG-pv5.5.dll

FAILED: bin/vtkIOFFMPEG-pv5.5.dll lib/vtkIOFFMPEG-pv5.5.lib 

cmd.exe /C "cd . && C:\dashboards\support\cmake-3.13.2-win64-x64\bin\cmake.exe -E vs_link_dll --intdir=VTK\IO\FFMPEG\CMakeFiles\IOFFMPEG.dir --manifests  -- C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\link.exe /nologo VTK\IO\FFMPEG\CMakeFiles\IOFFMPEG.dir\vtkFFMPEGWriter.cxx.obj  /out:bin\vtkIOFFMPEG-pv5.5.dll /implib:lib\vtkIOFFMPEG-pv5.5.lib /pdb:bin\vtkIOFFMPEG-pv5.5.pdb /dll /version:5.5 /machine:x64  /INCREMENTAL:NO  lib\vtkIOMovie-pv5.5.lib lib\vtkIOVideo-pv5.5.lib C:\d\buildbot\fff8b192\build\install\lib\libavformat.a C:\d\buildbot\fff8b192\build\install\lib\libavcodec.a C:\d\buildbot\fff8b192\build\install\lib\libavutil.a C:\d\buildbot\fff8b192\build\install\lib\libswscale.a lib\vtkCommonExecutionModel-pv5.5.lib lib\vtkCommonDataModel-pv5.5.lib lib\vtkCommonTransforms-pv5.5.lib lib\vtkCommonMisc-pv5.5.lib lib\vtkCommonMath-pv5.5.lib lib\vtkCommonSystem-pv5.5.lib lib\vtkCommonCore-pv5.5.lib C:\d\buildbot\fff8b192\build\install\lib\tbb.lib lib\vtksys-pv5.5.lib ws2_32.lib Psapi.lib C:\d\buildbot\fff8b192\build\install\lib\libavutil.a kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."

LINK: command "C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\link.exe /nologo VTK\IO\FFMPEG\CMakeFiles\IOFFMPEG.dir\vtkFFMPEGWriter.cxx.obj /out:bin\vtkIOFFMPEG-pv5.5.dll /implib:lib\vtkIOFFMPEG-pv5.5.lib /pdb:bin\vtkIOFFMPEG-pv5.5.pdb /dll /version:5.5 /machine:x64 /INCREMENTAL:NO lib\vtkIOMovie-pv5.5.lib lib\vtkIOVideo-pv5.5.lib C:\d\buildbot\fff8b192\build\install\lib\libavformat.a C:\d\buildbot\fff8b192\build\install\lib\libavcodec.a C:\d\buildbot\fff8b192\build\install\lib\libavutil.a C:\d\buildbot\fff8b192\build\install\lib\libswscale.a lib\vtkCommonExecutionModel-pv5.5.lib lib\vtkCommonDataModel-pv5.5.lib lib\vtkCommonTransforms-pv5.5.lib lib\vtkCommonMisc-pv5.5.lib lib\vtkCommonMath-pv5.5.lib lib\vtkCommonSystem-pv5.5.lib lib\vtkCommonCore-pv5.5.lib C:\d\buildbot\fff8b192\build\install\lib\tbb.lib lib\vtksys-pv5.5.lib ws2_32.lib Psapi.lib C:\d\buildbot\fff8b192\build\install\lib\libavutil.a kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\vtkIOFFMPEG-pv5.5.dll.manifest" failed (exit code 1120) with the following output:

   Creating library lib\vtkIOFFMPEG-pv5.5.lib and object lib\vtkIOFFMPEG-pv5.5.exp

libavcodec.a(mpegvideodsp.o) : error LNK2001: unresolved external symbol ___chkstk_ms

libavutil.a(log.o) : error LNK2001: unresolved external symbol ___chkstk_ms

...

libavutil.a(timecode.o) : error LNK2001: unresolved external symbol __mingw_vsnprintf

libavutil.a(hash.o) : error LNK2001: unresolved external symbol __mingw_vsnprintf

...

We may need to rebuild the FFmpeg library that tomviz is using (IIRC, it’s cross-compiled using mingw from my Linux box). VS2015 can now compile FFmpeg natively, so maybe that’s the better solution here?

I think the thing might be that we’ve now started using FFmpeg via imported targets. There might need to be more information to get the mingw runtime linked in as well. However, the better solution is probably to just build FFmpeg instead of using a pre-built version.

Also, from the logs:

  Version from git (5.5) disagrees with hard coded version (5.6).  Either
  update the git tags or version.txt.

which means the cache is out-of-date.

Okay.

Automating the windows build for ffmpeg may be a bit challenging, because MSYS is required according to the official guide. But I think I can at least build it locally on the dashboard machine with Visual Studio 2015, and we can use it on the dashboard.

I’m going to try to build the same version of ffmpeg that the MinGW pre-built one used… I tried building the latest release of ffmpeg, but I get some linking errors with VTK. Not sure what is the latest version VTK supports.

eeloo tests against 4.0.3. But that’s a Linux build.

I was able to get a compiled version working for Windows with 64-bit Visual Studio 2015 and FFMPEG 2.8.15. I posted my build instructions here in case anyone wants to see them. Hopefully, this compiled version will work for us for tomviz.