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 317048 - gstreamer Cygwin build fixes
gstreamer Cygwin build fixes
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Cygwin
: Normal normal
: 0.10.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-09-23 17:23 UTC by Yaakov Selkowitz
Modified: 2006-04-11 18:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstreamer-0.8.11 Cygwin build patch (4.18 KB, patch)
2005-09-23 17:23 UTC, Yaakov Selkowitz
none Details | Review
gstreamer-0.9.5 Cygwin patch (1.68 KB, patch)
2005-11-22 02:29 UTC, Yaakov Selkowitz
none Details | Review
gst-plugins-base-0.9.5 Cygwin patch (3.37 KB, patch)
2005-11-23 00:59 UTC, Yaakov Selkowitz
none Details | Review
gst-plugins-good-0.9.5 Cygwin patch (3.33 KB, patch)
2005-11-23 01:00 UTC, Yaakov Selkowitz
none Details | Review
gst-plugins-bad-0.9.5 Cygwin patch (2.36 KB, patch)
2005-11-23 01:14 UTC, Yaakov Selkowitz
none Details | Review
gst-plugins-ugly-0.9.5 Cygwin patch (2.65 KB, patch)
2005-11-23 01:37 UTC, Yaakov Selkowitz
none Details | Review
gst-ffmpeg-0.9.6 Cygwin patch (2.27 KB, patch)
2005-11-24 22:03 UTC, Yaakov Selkowitz
none Details | Review
gst-plugins-bad-0.10.1 Cygwin glsink patch (2.49 KB, patch)
2006-02-22 01:26 UTC, Yaakov Selkowitz
committed Details | Review

Description Yaakov Selkowitz 2005-09-23 17:23:23 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.
Comment 1 Yaakov Selkowitz 2005-09-23 17:23:58 UTC
Created attachment 52560 [details] [review]
gstreamer-0.8.11 Cygwin build patch
Comment 2 Yaakov Selkowitz 2005-11-18 00:52:05 UTC
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?
Comment 3 Tim-Philipp Müller 2005-11-18 09:22:40 UTC
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.
Comment 4 Yaakov Selkowitz 2005-11-18 19:01:11 UTC
Thanks for the heads-up.  I'll see what I can do.
Comment 5 Yaakov Selkowitz 2005-11-22 02:29:29 UTC
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.
Comment 6 Yaakov Selkowitz 2005-11-23 00:59:35 UTC
Created attachment 55113 [details] [review]
gst-plugins-base-0.9.5 Cygwin patch
Comment 7 Yaakov Selkowitz 2005-11-23 01:00:03 UTC
Created attachment 55114 [details] [review]
gst-plugins-good-0.9.5 Cygwin patch
Comment 8 Yaakov Selkowitz 2005-11-23 01:14:43 UTC
Created attachment 55118 [details] [review]
gst-plugins-bad-0.9.5 Cygwin patch
Comment 9 Yaakov Selkowitz 2005-11-23 01:37:18 UTC
Created attachment 55123 [details] [review]
gst-plugins-ugly-0.9.5 Cygwin patch
Comment 10 Yaakov Selkowitz 2005-11-23 02:12:09 UTC
gst-ffmpeg to follow tomorrow.
Comment 11 Thomas Vander Stichele 2005-11-24 12:16:50 UTC
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
Comment 12 Yaakov Selkowitz 2005-11-24 19:05:09 UTC
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.
Comment 13 Yaakov Selkowitz 2005-11-24 22:03:32 UTC
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.
Comment 14 Thomas Vander Stichele 2005-11-27 17:02:59 UTC
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 ;)
Comment 15 Yaakov Selkowitz 2005-11-27 21:26:36 UTC
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.
Comment 16 Yaakov Selkowitz 2005-11-28 22:18:28 UTC
Back to 1.A.
In gstreamer, gst/indexers/Makefile.am: libgstindexers_la_LIBADD needs $(XML_LIBS).
Comment 17 Yaakov Selkowitz 2005-12-04 02:45:56 UTC
Any chance of resolving this before 0.10, based on my comment #15 and comment #16?
Comment 18 Yaakov Selkowitz 2005-12-06 23:22:17 UTC
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.
Comment 19 Yaakov Selkowitz 2005-12-25 03:53:38 UTC
Any news on fixing the last remaining issues?
Comment 20 Thomas Vander Stichele 2006-01-13 14:15:03 UTC
a fix for 1.a commited to HEAD - please review since it's tied up in some other Makefile.am logic
Comment 21 Thomas Vander Stichele 2006-01-13 14:18:47 UTC
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 ?
Comment 22 David Schleef 2006-01-13 18:10:15 UTC
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.
Comment 23 Yaakov Selkowitz 2006-01-13 20:38:59 UTC
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?).
Comment 24 Yaakov Selkowitz 2006-01-19 01:06:12 UTC
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'
Comment 25 Yaakov Selkowitz 2006-01-19 01:53:38 UTC
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
Comment 26 Yaakov Selkowitz 2006-01-31 02:44:19 UTC
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
Comment 27 Yaakov Selkowitz 2006-02-14 01:23:00 UTC
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.
Comment 28 Tim-Philipp Müller 2006-02-14 11:07:03 UTC
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?

Comment 29 Yaakov Selkowitz 2006-02-14 23:18:23 UTC
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.
Comment 30 Yaakov Selkowitz 2006-02-22 01:26:59 UTC
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.
Comment 31 Jan Schmidt 2006-02-22 14:25:04 UTC
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?
Comment 32 Yaakov Selkowitz 2006-02-23 19:32:31 UTC
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).
Comment 33 Tim-Philipp Müller 2006-02-24 10:41:37 UTC
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?
Comment 34 Tim-Philipp Müller 2006-04-11 18:43:38 UTC
 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).