After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 784943 - Decklink from gst-plugins-bad cannot be built on windows using Cerbero
Decklink from gst-plugins-bad cannot be built on windows using Cerbero
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal enhancement
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-14 09:56 UTC by Felipe Mogollón
Modified: 2017-07-20 21:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
decklink: Add autotools support on Windows (1.89 KB, patch)
2017-07-14 11:01 UTC, Nirbheek Chauhan
committed Details | Review
recipes: Enable decklink in gst-plugins-bad on Windows (2.15 KB, patch)
2017-07-14 11:31 UTC, Nirbheek Chauhan
committed Details | Review

Description Felipe Mogollón 2017-07-14 09:56:33 UTC
If I run

./cerbero-uninstalled -c config/cross-win64 bootstrap
./cerbero-uninstalled -c config/cross-win64 build gst-plugins-bad-1.0

no libgstdecklink.dll is created.
Diving into gst-plugins-bad-1.0/sys/decklink folder can be seen that there is a Makefile but It doesn't work.

It has several errors:

* Cannot find mingw compiler
* Cannot find pthread.h
* Cannot find dlfcn.h

I could solve those issues by adding my mingw compiler to PATH manually and adding include paths to those headers manually to the Makefile file.

Running the Makefile we can get the following error:

    Creating library file: .libs/libgstdecklink.dll.a
    .libs/libgstdecklink_la-gstdecklink.o: In function `init_devices':
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/gstdecklink.cpp:1012: undefined reference to `__imp_SysFreeString'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/gstdecklink.cpp:989: undefined reference to `IID_IDeckLinkOutput'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/gstdecklink.cpp:1027: undefined reference to `IID_IDeckLinkConfiguration'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/gstdecklink.cpp:1034: undefined reference to `IID_IDeckLinkAttributes'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/gstdecklink.cpp:952: undefined reference to `IID_IDeckLinkInput'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/gstdecklink.cpp:974: undefined reference to `__imp_SysFreeString'
    linux/.libs/libgstdecklink_la-DeckLinkAPIDispatch.o: In function `InitDeckLinkAPI':
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:58: undefined reference to `dlopen(char const*, int)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:67: undefined reference to `dlsym(void*, char const*)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:70: undefined reference to `dlsym(void*, char const*)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:73: undefined reference to `dlsym(void*, char const*)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:76: undefined reference to `dlsym(void*, char const*)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:78: undefined reference to `dlerror()'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:69: undefined reference to `dlerror()'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:72: undefined reference to `dlerror()'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:75: undefined reference to `dlerror()'
    linux/.libs/libgstdecklink_la-DeckLinkAPIDispatch.o: In function `InitDeckLinkPreviewAPI':
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:85: undefined reference to `dlopen(char const*, int)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:91: undefined reference to `dlsym(void*, char const*)'
    /home/VICOMTECH/fmogollon/trabajo/bideoakta/cerbero/build/sources/windows_x86_64/gst-plugins-bad-1.0-1.13.0.1/sys/decklink/linux/DeckLinkAPIDispatch.cpp:93: undefined reference to `dlerror()'
    collect2: error: ld returned 1 exit status
    Makefile:943: recipe for target 'libgstdecklink.la' failed
    make: *** [libgstdecklink.la] Error 1
Comment 1 Nirbheek Chauhan 2017-07-14 11:01:03 UTC
Created attachment 355581 [details] [review]
decklink: Add autotools support on Windows

Also add a missing windows file to EXTRA_DIST
Comment 2 Nirbheek Chauhan 2017-07-14 11:02:03 UTC
I've tested this on cross-win64 inside Cerbero, and it seems to build and install just fine for me. Do you think you can test it, Felipe?
Comment 3 Sebastian Dröge (slomo) 2017-07-14 11:09:54 UTC
Comment on attachment 355581 [details] [review]
decklink: Add autotools support on Windows

Now this only needs cerbero changes
Comment 4 Nirbheek Chauhan 2017-07-14 11:31:44 UTC
Created attachment 355586 [details] [review]
recipes: Enable decklink in gst-plugins-bad on Windows
Comment 5 Nirbheek Chauhan 2017-07-14 11:51:35 UTC
Comment on attachment 355581 [details] [review]
decklink: Add autotools support on Windows

Attachment 355581 [details] pushed as 528ae2c - decklink: Add autotools support on Windows
Comment 6 Nirbheek Chauhan 2017-07-14 11:52:06 UTC
Attachment 355586 [details] pushed as 563793f - recipes: Enable decklink in gst-plugins-bad on Windows
Comment 7 Felipe Mogollón 2017-07-14 20:45:03 UTC
It builds great, I can't test the dll right now because I don't have the card with me right know, I will check on Monday but I am sure it will work fine.

Thanks for the fix, bug is closed for me, thanks a lot!!
Comment 8 Philippe Renon 2017-07-18 17:01:45 UTC
Seems like this change breaks the msys2/mingw build.


libtool: compile:  i686-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I../../../gst-plugins-bad/sys/decklink -I../.. -I../../../gst-plugins-bad/gst-libs -I../../gst-libs -pthread -mms-bitfields -ID:/msys64/mingw32/include/gstreamer-1.0 -ID:/msys64/mingw32/include/glib-2.0 -ID:/msys64/mingw32/lib/glib-2.0/include -ID:/msys64/mingw32/include -pthread -mms-bitfields -ID:/msys64/mingw32/include/gstreamer-1.0 -ID:/msys64/mingw32/include/glib-2.0 -ID:/msys64/mingw32/lib/glib-2.0/include -ID:/msys64/mingw32/include -pthread -mms-bitfields -ID:/msys64/mingw32/include/gstreamer-1.0 -ID:/msys64/mingw32/include/glib-2.0 -ID:/msys64/mingw32/lib/glib-2.0/include -ID:/msys64/mingw32/include -DGST_USE_UNSTABLE_API -DG_THREADS_MANDATORY -DG_DISABLE_DEPRECATED -Wall -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar -g -DGST_DISABLE_DEPRECATED -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -I/mingw32/include -march=i686 -mtune=generic -O2 -pipe -MT libgstdecklink_la-gstdecklink.lo -MD -MP -MF .deps/libgstdecklink_la-gstdecklink.Tpo -c ../../../gst-plugins-bad/sys/decklink/gstdecklink.cpp  -DDLL_EXPORT -DPIC -o .libs/libgstdecklink_la-gstdecklink.o
In file included from ../../../gst-plugins-bad/sys/decklink/gstdecklink.h:35:0,
                 from ../../../gst-plugins-bad/sys/decklink/gstdecklink.cpp:27:
../../../gst-plugins-bad/sys/decklink/win/DeckLinkAPI.h:19:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning( disable: 4049 )  /* more than 64k source lines */

In file included from ../../../gst-plugins-bad/sys/decklink/gstdecklink.h:37:0,
                 from ../../../gst-plugins-bad/sys/decklink/gstdecklink.cpp:27:
D:/msys64/mingw32/i686-w64-mingw32/include/comdef.h: In member function 'const TCHAR* _com_error::ErrorMessage() const':
D:/msys64/mingw32/i686-w64-mingw32/include/comdef.h:143:4: error: 'sprintf_s' was not declared in this scope
    _COM_PRINTF_S_1(m_pszMsg,32,TEXT("IDispatch error #%d"),wCode);
    ^
D:/msys64/mingw32/i686-w64-mingw32/include/comdef.h:143:4: note: suggested alternative: 'wsprintfW'
D:/msys64/mingw32/i686-w64-mingw32/include/comdef.h:145:4: error: 'sprintf_s' was not declared in this scope
    _COM_PRINTF_S_1(m_pszMsg,32,TEXT("Unknown error 0x%0lX"),m_hresult);
    ^
...



Workaround is to configure with --disable-decklink.
Comment 9 Nirbheek Chauhan 2017-07-18 17:30:39 UTC
This is a mingw bug: https://sourceforge.net/p/mingw-w64/bugs/525/

What's confusing is this only happens in mingw32, and works in mingw64.
Comment 10 Philippe Renon 2017-07-18 20:34:30 UTC
I'll try with mingw64 and will report back.
Comment 11 Nirbheek Chauhan 2017-07-18 21:00:22 UTC
The CI was showing a different cross-mingw32-only failure: https://ci.gstreamer.net/job/cerbero-cross-mingw32/6407/console

I fixed that with: https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=0084bfccc9d7d3ef3980bf942ce24bc83648b62a

Can you please use the latest git master in your tests?
Comment 12 Philippe Renon 2017-07-19 12:37:24 UTC
Warnings are gone but I still see the error (both with mingw32 and mingw64).

libtool: compile:  x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -I. -I../../../gst-plugins-bad/sys/decklink -I../.. -I../../../gst-plugins-bad/gst-libs -I../../gst-libs -pthread -mms-bitfields -ID:/msys64/mingw64/include/gstreamer-1.0 -ID:/msys64/mingw64/include/glib-2.0 -ID:/msys64/mingw64/lib/glib-2.0/include -ID:/msys64/mingw64/include -pthread -mms-bitfields -ID:/msys64/mingw64/include/gstreamer-1.0 -ID:/msys64/mingw64/include/glib-2.0 -ID:/msys64/mingw64/lib/glib-2.0/include -ID:/msys64/mingw64/include -pthread -mms-bitfields -ID:/msys64/mingw64/include/gstreamer-1.0 -ID:/msys64/mingw64/include/glib-2.0 -ID:/msys64/mingw64/lib/glib-2.0/include -ID:/msys64/mingw64/include -DGST_USE_UNSTABLE_API -DG_THREADS_MANDATORY -DG_DISABLE_DEPRECATED -Wall -Wmissing-declarations -Wredundant-decls -Wwrite-strings -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar -g -DGST_DISABLE_DEPRECATED -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -I/mingw64/include -march=x86-64 -mtune=generic -O2 -pipe -MT libgstdecklink_la-gstdecklink.lo -MD -MP -MF .deps/libgstdecklink_la-gstdecklink.Tpo -c ../../../gst-plugins-bad/sys/decklink/gstdecklink.cpp  -DDLL_EXPORT -DPIC -o .libs/libgstdecklink_la-gstdecklink.o
In file included from ../../../gst-plugins-bad/sys/decklink/gstdecklink.h:35:0,
                 from ../../../gst-plugins-bad/sys/decklink/gstdecklink.cpp:27:
../../../gst-plugins-bad/sys/decklink/win/DeckLinkAPI.h:19:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning( disable: 4049 )  /* more than 64k source lines */

In file included from ../../../gst-plugins-bad/sys/decklink/gstdecklink.h:37:0,
                 from ../../../gst-plugins-bad/sys/decklink/gstdecklink.cpp:27:
D:/msys64/mingw64/x86_64-w64-mingw32/include/comdef.h: In member function 'const TCHAR* _com_error::ErrorMessage() const':
D:/msys64/mingw64/x86_64-w64-mingw32/include/comdef.h:143:4: error: 'sprintf_s' was not declared in this scope
    _COM_PRINTF_S_1(m_pszMsg,32,TEXT("IDispatch error #%d"),wCode);
    ^
D:/msys64/mingw64/x86_64-w64-mingw32/include/comdef.h:143:4: note: suggested alternative: 'wsprintfW'
D:/msys64/mingw64/x86_64-w64-mingw32/include/comdef.h:145:4: error: 'sprintf_s' was not declared in this scope
    _COM_PRINTF_S_1(m_pszMsg,32,TEXT("Unknown error 0x%0lX"),m_hresult);
    ^
D:/msys64/mingw64/x86_64-w64-mingw32/include/comdef.h:145:4: note: suggested alternative: 'wsprintfW'



But note that this is an msys2 build so comes, I believe, with its own set of windows headers. I am not yet familiar on how msys2 and mingw articulate.

Will try to look into it. I have searched all good/bad/ugly plugins to see if another plugin was also including comutil.h, but none do : so no working example of using that header.
Comment 13 Philippe Renon 2017-07-19 14:51:53 UTC
Offending part in comutil.h :

/* Use of wsprintf might be impossible, if strsafe.h is included. */
#ifndef __STDC_SECURE_LIB__
#define _COM_PRINTF_S_1(dest,destsize,format,arg1) wsprintf(dest,format,arg1)
#elif defined(UNICODE)
#define _COM_PRINTF_S_1(dest,destsize,format,arg1) swprintf_s(dest,destsize,format,arg1)
#else
#define _COM_PRINTF_S_1(dest,destsize,format,arg1) sprintf_s(dest,destsize,format,arg1)
#endif
Comment 14 Philippe Renon 2017-07-19 16:18:06 UTC
Adding #include <stdio.h> before #include <comutil.h> in gstdecklink.h and
changing line DECKLINK_LIBS="-loleaut32" to DECKLINK_LIBS="-lole32 -loleaut32" in the root configure.ac file allows the build to complete.


$ gst-inspect-1.0.exe decklink
Plugin Details:
  Name                     decklink
  Description              Blackmagic Decklink plugin
  Filename                 D:\msys64\mingw64\lib\gstreamer-1.0\libgstdecklink.dll
  Version                  1.13.0.1
  License                  LGPL
  Source module            gst-plugins-bad
  Source release date      2017-07-19 15:31 (UTC)
  Binary package           GStreamer Bad Plug-ins
  Origin URL               Unknown package origin

  decklinkvideosrc: Decklink Video Source
  decklinkaudiosrc: Decklink Audio Source
  decklinkvideosink: Decklink Video Sink
  decklinkaudiosink: Decklink Audio Sink

  4 features:
  +-- 4 elements
Comment 15 Nirbheek Chauhan 2017-07-20 13:49:18 UTC
Thanks! I've tested your changes on cross-mingw and pushed. Closing.
Comment 16 Philippe Renon 2017-07-20 21:03:26 UTC
Sorry, forgot to mention a last issue.

The following line in ./win/DeckLinkAPI.h 

  #pragma warning( disable: 4049 )  /* more than 64k source lines */

fails with msys2/mingw/gcc.

I think that #pragma is specific to MSVC and should be #ifdef'ed as such.