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 572993 - [subparse] broken libregex dependency on Windows
[subparse] broken libregex dependency on Windows
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Windows
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-24 15:01 UTC by LRN
Modified: 2009-03-03 09:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use GLib regex functions instead of regex.h (2.67 KB, patch)
2009-02-28 01:33 UTC, LRN
none Details | Review
Use GLib regex functions instead of rege.h; Use GOnce to init regexps (3.87 KB, patch)
2009-02-28 10:18 UTC, LRN
none Details | Review
Use GLib regex functions instead of regex.h when glib 2.16 is available; Use GOnce to init regexps (for both regex.h and glib); (5.46 KB, patch)
2009-02-28 11:06 UTC, LRN
none Details | Review
Use GLib regex functions instead of regex.h when glib 2.16 is available; Use GOnce to init regexps (for both regex.h and glib); (5.51 KB, patch)
2009-02-28 11:10 UTC, LRN
none Details | Review
Use GLib regex functions instead of regex.h when glib 2.16 is available; Use GOnce to init regexps (for both regex.h and glib); (5.54 KB, patch)
2009-02-28 11:25 UTC, LRN
committed Details | Review

Description LRN 2009-02-24 15:01:25 UTC
I'm trying to build plugins-base (with enabled subparse) on Windows with MinGW/MSys. It requires reg* functions (declared in regex.h). I found necessary package (with import library, shared library and header) at http://sourceforge.net/project/showfiles.php?group_id=7382&package_id=12650

Configure picks up regex.h and subsequently enables subparse, however it never passes -lregex to the linker (and i can't find a place where it should do that, it seems that configure script is not supposed to do that at all), as a result subparse fails to build:

libtool: link:  gcc -shared .libs/libgstsubparse.dll.def  .libs/libgstsubparse_la-gstssaparse.o .libs/libgstsubparse_la-gstsubparse.o .libs/libgstsubparse_la-samiparse.o .libs/libgstsubparse_la-tmplayerparse.o .libs/libgstsubparse_la-mpl2parse.o   -LD:/msys/local/lib -L/usr/local/lib -L/d/python26/Lib /usr/local/lib/libgstbase-0.10.dll.a /usr/local/lib/libgstreamer-0.10.dll.a -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 /usr/local/lib/libxml2.dll.a -ldl -lpthread -lws2_32 -lglib-2.0 /usr/local/lib/libintl.dll.a /usr/local/lib/libiconv.dll.a  -mms-bitfields -mms-bitfields   -o .libs/libgstsubparse.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libgstsubparse.dll.a
Info: resolving ___gst_debug_min by linking to __imp____gst_debug_min (auto-import)
Creating library file: .libs/libgstsubparse.dll.a
d:/mingw/bin/../lib/gcc/mingw32/4.3.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
.libs/libgstsubparse_la-gstsubparse.o: In function `gst_sub_parse_data_format_autodetect':
d:\projects\gst-plugins-base\gst\subparse/gstsubparse.c:1003: undefined reference to `regexec'
d:\projects\gst-plugins-base\gst\subparse/gstsubparse.c:1007: undefined reference to `regexec'
d:\projects\gst-plugins-base\gst\subparse/gstsubparse.c:992: undefined reference to `regcomp'
d:\projects\gst-plugins-base\gst\subparse/gstsubparse.c:992: undefined reference to `regcomp'
d:\projects\gst-plugins-base\gst\subparse/gstsubparse.c:998: undefined reference to `regerror'

configuring with LDFLAGS="-L/local/lib" and LIBS="-lregex" fixes the problem.

Alternatively you may want to rewrite subparse to use GLib for regular expressions.
Comment 1 LRN 2009-02-28 01:33:43 UTC
Created attachment 129704 [details] [review]
Use GLib regex functions instead of regex.h

Only tested on .srt files.
Comment 2 David Schleef 2009-02-28 05:29:26 UTC
Only the return value of g_regex_new() needs to be tested for NULL:

- if (mdvd_grx == NULL || gerr != NULL) {
+ if (mdvd_grx == NULL) {

The GST_WARNINGs should be g_warning()s.

As a side note, the creation of regexes here is not thread-safe, but it is unsafe without the patch too.  I'd like to see this code fixed to use GOnce.  If you want to fix it, go ahead, otherwise just mark it /* FIXME thread unsafe, should use GOnce */.
Comment 3 Sebastian Dröge (slomo) 2009-02-28 09:27:10 UTC
The best would probably be to initialize the regex in class_init or plugin_init and have them as static global variables IMHO.

Apart from that this patch needs #if GLIB_CHECK_VERSION(2,16,0) around the GRegex stuff and the old stuff in the #else part until we can depend on GLib 2.16.0 or newer... which is soon I hope :)
Comment 4 LRN 2009-02-28 10:18:21 UTC
Created attachment 129723 [details] [review]
Use GLib regex functions instead of rege.h; Use GOnce to init regexps

Didn't tested at all.
Comment 5 LRN 2009-02-28 11:06:02 UTC
Created attachment 129728 [details] [review]
Use GLib regex functions instead of regex.h when glib 2.16 is available; Use GOnce to init regexps (for both regex.h and glib);
Comment 6 LRN 2009-02-28 11:10:16 UTC
Created attachment 129729 [details] [review]
Use GLib regex functions instead of regex.h when glib 2.16 is available; Use GOnce to init regexps (for both regex.h and glib);

Forgot to #include <regex.h>
Obviously, didn't tested the pre-glib-2.16 variant.
Comment 7 LRN 2009-02-28 11:25:04 UTC
Created attachment 129731 [details] [review]
Use GLib regex functions instead of regex.h when glib 2.16 is available; Use GOnce to init regexps (for both regex.h and glib);

This one builds with both GLib < 2.14 and GLib >= 2.14.
Comment 8 Sebastian Dröge (slomo) 2009-03-02 15:35:34 UTC
David, are you going to commit this? Looks good to me except that GRegex was actually available since 2.14, not 2.16 :)
Comment 9 Michael Smith 2009-03-02 18:33:51 UTC
As discussed on IRC, we shouldn't be committing this - patches not attributable to a real person aren't acceptable. "LRN" refuses to provide this information, so though his/her bug reports are still valuable, the patches aren't usable.
Comment 10 LRN 2009-03-02 19:17:41 UTC
Name's Руслан Ижбулатов.
Now go and submit that patch already!
Comment 11 David Schleef 2009-03-02 22:23:45 UTC
commit db596d27a29309eff2d7060405998bd6a68bfc31
Author: LRN <lrn1986@gmail.com>
Date:   Sat Feb 28 15:23:20 2009 -0800

    subparse: Convert regex code to GRegex code
    
    Fixes: #572993.  Patch author prefers to use an alias, contact
    ds if you actually need a real name.
    
    Signed-off-by: David Schleef <ds@schleef.org>