GNOME Bugzilla – Bug 317048
gstreamer Cygwin build fixes
Last modified: 2006-04-11 18:43:38 UTC
Version details: 0.8.11 On Cygwin (and MinGW), shared libraries and modules must have all symbols resolved at link time. This involves passing "-no-undefined" to libtool via *_la_LDFLAGS and all required link libs in *_la_LIBADD. I'm attaching a patch which fixes these issues on Cygwin with gstreamer-0.8.11. * configure.ac: add -no-undefined to GST_LIB_LDFLAGS and GST_PLUGIN_LDFLAGS; add GST_LIB_LIBS to GST_OBJ_LIBS. * gst/Makefile.am: add -no-undefined to libgstreamer_@GST_MAJORMINOR@_la_LDFLAGS * gst/elements/gstmultifilesrc.c: Cygwin (as of 1.5.18) does not provide madvise * libs/gst/bytestream/Makefile.am: correct definition of libgstbytestream_la_LIBADD There is one additional issue, that the getbits-i386 code doesn't compile on Cygwin. Perhaps the best way to work around this is not to define HAVE_CPU_I386 if $target_os = cygwin.
Created attachment 52560 [details] [review] gstreamer-0.8.11 Cygwin build patch
After building gst-plugins, I see that Cygwin (and certainly not MinGW) won't work until the prelink problems are fixed in GStreamer, since by definition on both platforms all shared libraries and modules must have all symbols resolved at link time. Could I get more information about the roots of the prelink problem?
I think these problems are resolved in the current development version (0.9.x). As 0.10.0 is due in less than three weeks, it might be more worthwhile to focus on 0.9.
Thanks for the heads-up. I'll see what I can do.
Created attachment 55063 [details] [review] gstreamer-0.9.5 Cygwin patch OK, here's my patch for gstreamer-0.9.5; gst-plugins-base will be next.
Created attachment 55113 [details] [review] gst-plugins-base-0.9.5 Cygwin patch
Created attachment 55114 [details] [review] gst-plugins-good-0.9.5 Cygwin patch
Created attachment 55118 [details] [review] gst-plugins-bad-0.9.5 Cygwin patch
Created attachment 55123 [details] [review] gst-plugins-ugly-0.9.5 Cygwin patch
gst-ffmpeg to follow tomorrow.
Hi, I'm a bit confused - the mingw build seems to be working fine without these patches. Are you sure they are needed ? Could you show me whatever build failure you're trying to fix without the patch ? I will try and see if I can reproduce in cygwin. Thanks
I just built all the 0.9.5 tarballs in order to see how they would work, so I'm absolutely sure that these, at least, *were* needed as of 0.9.5 (except, see 1.B. below). 1) gstreamer A. configure.ac: add XML_LIBS to GST_ALL_LIBS. libgstreamer-0.9 *does* explicitely depend on libxml2: $ cygcheck /usr/bin/cyggstreamer-0.9-7.dll C:/cygwin/bin/cyggstreamer-0.9-7.dll C:/cygwin/bin\cygwin1.dll C:\WINDOWS\system32\ADVAPI32.DLL C:\WINDOWS\system32\ntdll.dll C:\WINDOWS\system32\KERNEL32.dll C:\WINDOWS\system32\RPCRT4.dll C:/cygwin/bin\cygglib-2.0-0.dll C:/cygwin/bin\cygiconv-2.dll C:/cygwin/bin\cygintl-3.dll C:/cygwin/bin\cyggmodule-2.0-0.dll C:/cygwin/bin\cyggobject-2.0-0.dll C:/cygwin/bin\cyggthread-2.0-0.dll C:/cygwin/bin\cygxml2-2.dll C:/cygwin/bin\cygz.dll B. configure.ac: add -no-undefined to GST_PLUGIN_LDFLAGS. I missed that -no-undefined was already in GST_ALL_LDFLAGS, so this part is actually unnecessary. 2. gst-plugins-base A. Makefile.am: defined ACLOCAL_AMFLAGS. This is necessary for running autoreconf before configure; note that gstreamer/Makefile.am already has this. B. common/m4/as-libtool.m4: add -no-undefined to *_LT_LDFLAGS. Unlike in gstreamer, this isn't defined anywhere else, so I added it here. C. sys/ximage/Makefile.am, sys/xvimage/Makefile.am: add GST(_BASE)_LIBS to LIBADD. I highly doubt anyone built these on MinGW. :-) 3. gst-plugins-good A. Makefile.am; B. common/m4/as-libtool.m4; Same as above. C. gst/rtsp/rtspconnection.c: fix includes. This was necessary due to a compile error. D. gst/videofilter/Makefile.am: fix LDFLAGS and define LIBADD. Without this, libgstvideofilter-0.9 doesn't get '-no-undefined' (once common/m4/as-libtool.m4 is fixed, above) or proper versioning. 4. gst-plugins-bad A. Makefile.am; B. common/m4/as-libtool.m4; Same as above. C. configure.ac: add -no-undefined to GST_PLUGIN_LDFLAGS. Already been fixed in CVS. 5. A. Makefile.am; B. common/m4/as-libtool.m4; Same as above. C. configure.ac: s/GST_PLUGINS_GOOD/GST_PLUGINS_UGLY/ Already been fixed in CVS. D. configure.ac: add -no-undefined to GST_PLUGIN_LDFLAGS. Already been fixed in CVS.
Created attachment 55200 [details] [review] gst-ffmpeg-0.9.6 Cygwin patch Although this patch was originally taken from 0.9.5, I've removed obsolete sections wrt fixes in 0.9.6.
Thanks for breaking this down step by step. 1.A.: check gstreamer/gst/Makefile.am: libgstreamer_@GST_MAJORMINOR@_la_LIBADD = \ $(GST_PARSE_LA) \ $(GST_ALL_LIBS) \ $(XML_LIBS) libgstreamer is explicitly linked to the xml libraries; there's no need to add it to GST_ALL_LIBS 1.B: you've said this isn't needed yourself. 2.A: added 2.B: AS_LIBTOOL is the wrong location for this - see the explanation of what the macro does. I added GST_ALL_LDFLAGS in configure.ac instead and added it to the libs' LDFLAGS. 2.C: those plugins link to libgstvideo, which links to libgstbase. this should be enough, there should be no reason to link them explicitly in, unless I'm missing something ? Obviously you're right in that I can't compile them in MingW. Is it possible to compile them in cygwin ? 3.A: as above 3.B: as above 3.C: commited, thanks 4.A: as above 4.B: as above 4.C: already done 5.A: as above 5.B: as above 5.C: already done 5.D: already done ffmpeg stuff: commited Please get back to me on 1A and 2C, the last remaining bits from this bug. And let us know your name so we can properly attribute fixes in the future ;)
1.A. I added XML_LIBS because I ran into some undefined symbols in one of the libraries; I'll have to go back and find out which one it was. 2.C. The fact that libgstvideo is linked to libgstbase and libgstreamer doesn't help when symbols from libgstreamer/libgstbase are explicitly used; in that case, one must explicitly link against those libraries as well, otherwise those symbols will be undefined at link time and will exit with error on Cygwin (and AFAIK MinGW as well). Yes, these do compile on Cygwin and link after patching as above; xorg-x11 is available as part of the Cygwin distribution.
Back to 1.A. In gstreamer, gst/indexers/Makefile.am: libgstindexers_la_LIBADD needs $(XML_LIBS).
Any chance of resolving this before 0.10, based on my comment #15 and comment #16?
Re comment #16 wrt gstreamer-0.10.0: plugins/indexers/Makefile.am: libgstcoreindexers_la_LIBADD needs $(XML_LIBS) Also, something new in gstreamer-0.10.0: While compiling libs/gst/net/gstnettimepacket.c: /home/Yaakov/src/gnome/gstreamer/gstreamer-0.10.0/libs/gst/net/gstnettimepacket.c: In function `gst_net_time_packet_send': /home/Yaakov/src/gnome/gstreamer/gstreamer-0.10.0/libs/gst/net/gstnettimepacket.c:174: error: `MSG_DONTWAIT' undeclared (first use in this function) /home/Yaakov/src/gnome/gstreamer/gstreamer-0.10.0/libs/gst/net/gstnettimepacket.c:174: error: (Each undeclared identifier is reported only once /home/Yaakov/src/gnome/gstreamer/gstreamer-0.10.0/libs/gst/net/gstnettimepacket.c:174: error: for each function it appears in.) make[4]: *** [libgstnet_0.10_la-gstnettimepacket.lo] Error 1 MSG_DONTWAIT isn't implemented on Cygwin.
Any news on fixing the last remaining issues?
a fix for 1.a commited to HEAD - please review since it's tied up in some other Makefile.am logic
re: 2.c, I double-checked your patch. Why use GST_LIBS in xvimagesink and GST_BASE_LIBS in ximage ? the MSG_DONTWAIT issue, what do you recommend we do ?
MSG_DONTWAIT means: val = fcntl (fd, F_GETFL, 0); fcntl (fd, F_SETFL, val | O_NONBLOCK); sendto (fd, ...); fcntl (fd, F_SETFL, val); I didn't spend much time trying to figure this out, but it kind of appears that the write is supposed to be nonblocking, and the read is blocking. This is weird. In order to do this with fcntl(), one would have to do a { select(); recv() } loop to emulate blocking mode in the read.
Re: comment 20 (1.a) In theory looks good; if this doesn't work when it's released (0.10.2?), I'll let you know. Re: comment 21 (2.c) When I built 0.9.5, those were required to link. I tried just GST_LIBS for ximage, but there were still undefined symbols which needed GST_BASE_LIBS. Perhaps something has changed since then and 0.10.1, because now their dependency trees are identical. In any case, at a minimum GST_LIBS is needed for both, obviously. Re: comment 21 (MSG_DONTWAIT) The following are implemented in Cygwin: #define MSG_OOB 0x1 /* process out-of-band data */ #define MSG_PEEK 0x2 /* peek at incoming message */ #define MSG_DONTROUTE 0x4 /* send without using routing tables */ #define MSG_WINMASK 0x7 /* flags understood by WinSock calls */ #define MSG_NOSIGNAL 0x20 /* Don't raise SIGPIPE */ From googling, other packages have dealt with this in various ways: 1) The cheap solution: #ifndef MSG_DONTWAIT #define MSG_DONTWAIT 0x40 #endif This will compile, but I have no idea how and if it would actually run, since Cygwin won't know what to do with that value. 2) A little more sophisticated, based on GNUnet's solution[1] [1] http://www.ovmj.org/GNUnet/doxygen/html/io_8c-source.html gint flags; #ifdef G_WITH_CYGWIN flags = MSG_NOSIGNAL; #else flags = MSG_DONTWAIT | MSG_NOSIGNAL; #endif ret = sendto (fd, buffer, GST_NET_TIME_PACKET_SIZE, flags, addr, len); This could be expanded to support other platforms as necessary (see the GNUnet source, starting line 126, for details). Again, I don't know how this actually runs, but it's appears a little more sane. In the meantime I've used the second solution to build gstreamer-0.10, but I have no idea if this is working correctly (got a test case?).
Re: comment 23 (1.a) Fix confirmed with 0.10.2. Re: comment 23 (2.c) Patch is still correct for 0.10.2. Here's why GST_LIBS isn't enough: /home/Yaakov/src/gnome/gst-plugins/base/gst-plugins-base-0.10.2/sys/ximage/ximagesink.c:1157: undefined reference to `_gst_base_sink_get_type'
New issue: gst-plugins-good-0.10.1: gst/rtp/gstasteriskh263.c: #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif #ifdef HAVE_WINSOCK2_H # include <winsock2.h> #endif That's bad news for Cygwin, as we have both, <netinet/in.h> for POSIX and <winsock2.h> from w32api. These conflict and cause a compile error. On Cygwin the POSIX interface is preferred, and AFAIK MinGW doesn't have <netinet/*>, so these should be made mutually exclusive, for example: #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #elif defined(HAVE_WINSOCK2_H) # include <winsock2.h> #endif
Just as some encouragement, that with all my nitpicking, GStreamer-0.10 seems to be working well on Cygwin. Here's a screenshot from gnome-media-2.13 with gstreamer-0.10.2: http://cygwinports.sunsite.dk/screenshots/gnome-media.jpg
New issue with gst-plugins-good-0.10.2: ext/cdio/Makefile.am: 's/GST_PLUGINS_BASE_/GST_BASE_/g' The libgstcdio module depends on symbols in libgstbase-0.10.
In response to comment #27: true, but the dependence on libgstbase-0.10 is only indirect, it primarily depends directly on libgstcddabasesrc-0.10, so there are two ways of fixing this as far as I can see: a) by adding GST_BASE_LIBS and GST_BASE_CFLAGS to Makefile.am, or b) by adding gstreamer-base-0.10 to the requirements in the gstreamer-plugins-base-0.10.pc file, so that the above flags are part of GST_PLUGINS_BASE_* automatically. I am leaning towards b) as The Right Thing To Do, but others might feel it just adds unnecessary clutter, so dunno. Thomas?
Re comment #28: It's not 100% true that the libgstbase-0.10 dependency is indirect; during linking with GST_PLUGINS_BASE_LIBS, there was one undefined symbol which libgstbase-0.10 provides. Keep in mind that cdio is the *only* module in -good that needs this fix (among all modules in gst/, one in sys/, and 12 in ext/); hence AFAICS a) is all that's necessary and that b) is an overkill.
Created attachment 59896 [details] [review] gst-plugins-bad-0.10.1 Cygwin glsink patch Another release, another new issue... I know a lot of distributions have moved or are moving X11 into /usr, but this can't be assumed. Cygwin still uses /usr/X11R6. Also, the new glsink plugin in -bad doesn't use libGLU, just libGL. I'm attaching a new patch which fixes these issues for gst-plugins-bad-0.10.1.
I'd already moved the AC_PATH_XTRA above the AC_CHECK_HEADER as part of merging XImageSrc. The other parts look fine. Applying atm. How many of the other patches on this bug are still relevant?
At this point the patches themselves are mostly applied already or obsolete, except for parts of the -base patch, see below. Outstanding issues: core: 1. libs/gst/net/gstnettimepacket.c: MSG_DONTWAIT not defined on Cygwin (comment 23). -base: 2. sys/ximage/Makefile.am (libgstximage_la_LIBADD): add $(GST_BASE_LIBS). 3. sys/xvimage/Makefile.am (libgstxvimage_la_LIBADD): add $(GST_LIBS). (These two are included in the -base patch, but the other parts are obsolete.) -good: 4. ext/cdio/Makefile.am (libgstcdio_la_LIBADD): add $(GST_BASE_LIBS) (comment 29). 5. gst/rtp/gstasteriskh263.c: fix includes (comment 25).
Committed fixes for -base and -good, so that just leaves the MSG_DONTWAIT issue. Further to David's comments in comment #22: gst_net_time_packet_receive() seems to only be called after a select() call has determined that the socket can be read from, and all uses of gst_net_time_packet_send() disregard the return value anyway, so we might be able to get away with just setting the socket to non-blocking mode while sending and let that be it, no?
2006-04-11 Tim-Philipp Müller <tim at centricular dot net> * libs/gst/net/gstnettimepacket.c: (gst_net_time_packet_send): MSG_DONTWAIT is not defined on Cygwin, so work around that (fixes #317048).