GNOME Bugzilla – Bug 573593
Linking static directx libraries to gstdirect* plugins on Windows
Last modified: 2009-08-09 10:23:42 UTC
gstdirectdrawsink and gstdirectsoundsink depend on libdxguid.a and libdxerr9.a Both .a files are static libraries (not import libraries) and do not have corresponding .dll files. According to libtool, they can only be linked to applications (executables), but not to .dlls, since linking static library to shared library may have unpleasant consequences on most OSes. Fortunately, gstdirecdrawsink and gstdirectsoundsink are THE cases when it is safe to link static library - there's no possibility of symbol duplication, they are C-only (right?) and PIC doesn't matter because .dlls don't support PIC. Unfortunately, libtool developers are aiming to be cross-platform and do not wish to implement features in libtool that are exclusive for some platforms (such as Win32). Because of that libtool can't (and won't) allow us to link these libraries to these plugins. Roumen Petrov suggested that one can pass library dependencies via "-Wl," syntax, in which case they are ignored by libtool.
Created attachment 129757 [details] [review] Link libdxguid.a and libdxerr9 statically Seems to be working correctly (both video and audio) from gst-launch.
FWIW, libtool links these plugins fine for me without requiring any changes. libtool is stupid in this case (well, more stupid than normal).
Maybe you DO have the .dll files in question and your copies of .a files are import libraries rather than static libraries? Where did you got your MinGW, DirectX SDK and which version are they? I also heard that it is possible to use specially crafted .la file to substitute for a lack of .dll, but i never managed to get it working that way.
Comment on attachment 129757 [details] [review] Link libdxguid.a and libdxerr9 statically diff --git a/configure.ac b/configure.ac index 5412d79..c0a2921 100644 --- a/configure.ac +++ b/configure.ac @@ -380,7 +380,8 @@ int main () if test "x$HAVE_DIRECTDRAW" = "xyes"; then dnl this is much more than we want - DIRECTDRAW_LIBS="-lddraw -ldxguid -lgdi32" + DIRECTDRAW_LIBS="-lddraw -lgdi32" + DIRECTDRAW_CFLAGS="-Wl,-ldxguid" AC_SUBST(DIRECTDRAW_CFLAGS) AC_SUBST(DIRECTDRAW_LDFLAGS) AC_SUBST(DIRECTDRAW_LIBS) @@ -421,7 +422,8 @@ int main () if test "x$HAVE_DIRECTSOUND" = "xyes"; then dnl this is much more than we want - DIRECTSOUND_LIBS="-ldsound -ldxerr9 -luser32" + DIRECTSOUND_CFLAGS="-Wl,-ldxerr9" + DIRECTSOUND_LIBS="-ldsound -luser32" AC_SUBST(DIRECTSOUND_CFLAGS) AC_SUBST(DIRECTSOUND_LDFLAGS) AC_SUBST(DIRECTSOUND_LIBS)
Created attachment 130001 [details] [review] Link dxguid and dxerr9 statically. Fixed an error (wrote things in wrong place).
Created attachment 136617 [details] [review] Pass -ldxerr9 around libtool via -Wl Since directdraw is not in -good anymore, i had to alter the patch. And it looks a bit different (just changed LIBS, without adding CFLAGS).
Created attachment 136820 [details] .la file for libdxerr9.a OK, i've tried the .la solution and finally got it working. Attached .la file as an example. When placed in /mingw/lib alongside with libdxerr9.a, it satisfies libtool. No, i don't know how (or why) it works. It just does. I'm going to report that on MinGW bug tracker and see what they have to say about it. Meanwhile, since it's not GStreamer's fault, this bug should be closed until further notice.
Ok, closing as NOTGNOME then.