[PATCH][W32] W32 and MSys compatibility

LRN lrn1986 at gmail.com
Thu May 31 09:18:28 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21.05.2012 16:37, Dan Nicholson wrote:> On Sat, May 19, 2012 at
4:09 PM, LRN <lrn1986 at gmail.com> wrote:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>> 
>> On 19.05.2012 23:26, Dan Nicholson wrote:
>>> On May 19, 2012 10:58 AM, "LRN" <lrn1986 at gmail.com> wrote:
>>>> 
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>> 
>>>> On 19.05.2012 21:13, LRN wrote:
>>>>> On 18.05.2012 20:36, Dan Nicholson wrote:
>>>>>> On Fri, May 18, 2012 at 09:21:08AM -0700, Dan Nicholson 
>>>>>> wrote:
>>>>>>> On Sat, Mar 31, 2012 at 09:27:54AM +0400, LRN wrote:
>>>>>>>> 09-fix-pkgconfig-pc-path-on.mingw32.patch: Can't use 
>>>>>>>> deprecated w32 functions with new glib :( Also leaks
>>>>>>>> a bit less memory (no that anyone would notice...)
>>>>>>> 
>>>>>>> This one is also in bug 45742. I liked your version of
>>>>>>> the patch better where a separate symbol was added.
>>>>>>> However, I like it even more if we always use the
>>>>>>> symbol and only use the conditional once when it's
>>>>>>> constructed. I also added a version check for glib in
>>>>>>> configure to make sure we have a new enough version.
>>>>>>> 
>>>>>>> Can you give the attached patch a shot and let me know
>>>>>>> if it works?
>>>>> 
>>>>>> Whoops, I missed a conditional in pkg.c I wanted to fix.
>>>>>> Can you try this patch?
>>>>> It compiles (against external glib). And passes all 12
>>>>> tests. I'll install the compiled binaries into my
>>>>> buildslave to see how they work
>>>> OK, found a silly bug in the patch, here's a patch that
>>>> fixes your patch.
>>> 
>>> Sheesh, good catch. I'll squash that in and commit soon.
>>> 
>>> Thanks for trying internal glib too. I tried it on a windows VM
>>> and hit some problems I didn't feel like investigating. I think
>>> libintl is unfortunately required on glib, so I think I'll have
>>> to add back GLIB_WITH_NLS at least. What's happening now is the
>>> equivalent of --disable-nls since we never define ENABLE_NLS,
>> Wrong. I get: /* always defined to indicate that i18n is enabled
>> */ #define ENABLE_NLS 1 My guess is that you forgot to
>> re-configure glib after patching it (or that you forgot to add
>> glib source directory to autogen.sh, here's a patch for that).
> 
> No, autoreconf is recursive. I just hadn't noticed that gettext
> wasn't really removed from configure. It's hard to be vigilant
> about it on linux since it's more or less part of libc.
> 
>> Also, you removed GLIB_GNU_GETTEXT from configure.ac, but left 
>> GLIB_DEFINE_LOCALEDIR intact. GLIB_DEFINE_LOCALEDIR requires 
>> GLIB_GNU_GETTEXT. Here's a patch for that too (you need to add 
>> CPPFLAGS=-DGLIB_LOCALE_DIR=\\\"/share/locale\\\", otherwise it
>> won't compile; the value itself is only used on W32).
> 
> Oh, that makes sense. I didn't know that pulled in
> GLIB_GNU_GETTEXT.
> 
>>> but clearly there's still code that needs symbols from
>>> libintl.
>> This might be trivially explained. Here's the list of missing
>> symbols: libintl_bindtextdomain libintl_bind_textdomain_codeset 
>> libintl_textdomain libintl_gettext libintl_dgettext 
>> libintl_dcgettext libintl_dngettext Note that the code never
>> calls any of these. However, libintl.h contains the following
>> defines: # define bindtextdomain libintl_bindtextdomain # define
>> bind_textdomain_codeset libintl_bind_textdomain_codeset # define
>> textdomain libintl_textdomain # define gettext libintl_gettext #
>> define dgettext libintl_dgettext # define dcgettext
>> libintl_dcgettext # define dngettext libintl_dngettext
>> 
>> while glib "disables" NLS by not including libintl.h and
>> defining
instead:
>> #define textdomain(String) ((String) ? (String) : "messages") 
>> #define gettext(String) (String) #define dgettext(Domain,String)
>> (String) #define dcgettext(Domain,String,Type) (String) #define
>> dngettext(Domain,String1,String2,N) ((N) == 1 ? (String1) : 
>> (String2)) #define bindtextdomain(Domain,Directory) (Domain) 
>> #define bind_textdomain_codeset(Domain,Codeset)
>> 
>> glibintl.h is not included by lots of files. libintl.h, on the
>> other hand, is only included by ggettext.c, gi18n-lib.h and
>> gi18n.h (and glibintl.h itself, obviously, when NLS is enabled).
>> 
>> So the problem should be fixable by removing #include <libintl.h>
>> from ggettext.c, replacing it with #include "glibintl.h". Here's
>> a patch.
>> 
>> That said, when compiled with internal glib, pkg-config
>> unexplainably crashes on gthread-win32.c:343
> 
> Hmm, so it seems avoiding libintl needs some surgery and you're 
> hitting a crash in the threading code. Do they seem related? Have
> you tried --with-internal-glib leaving the gettext/libintl code
> alone? Can you get a backtrace?

gdb log is attached.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPx5nTAAoJEOs4Jb6SI2CwOscIAJCWvdO33w+HT/e8D3fUzCIU
7B37GifP/a8yqPzbbPJv1MMIoi9mKtqGNlLk+fLyP3ykDLfKTqJ7LKEp7ndpINVZ
ou8c2Fe2tLD9/WXNlf16I3UDqQ35Nm1oCPA7TZfUrZcrMMXNE4i4lvdCkITLeElF
DuTPvuiKo+P38bYjH/FHyxOAiov8O3WwzXg5VgkKiAJGjSEwqyqclI91ShAKFOD1
TeYvwN10Tokw7aclc/MNKi0odfEmHySxgLwBiL2Uewn40ixaLEpjnBb1ZW2oPKK2
umpyqjHmZo+mxGmRj4q6iUmwgz154Mocwbu522I18kWFCWSjAdojZNezxnbAaiE=
=XGG3
-----END PGP SIGNATURE-----
-------------- next part --------------
Temporary breakpoint 2, main (argc=3, argv=0x822c98) at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/main.c:222
222       GSList *packages = NULL;
(gdb) n
226       FILE *log = NULL;
(gdb)
227       GError *error = NULL;
(gdb)
230       GOptionEntry options_table[] = {
(gdb)
307       if (getenv ("PKG_CONFIG_DEBUG_SPEW"))
(gdb)
317       init_pc_path ();
(gdb) s
init_pc_path () at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/main.c:172
172       instdir = g_win32_get_package_installation_directory_of_module (NULL);
(gdb) n
173       if (instdir == NULL)
(gdb)
182       lpath = g_build_filename (instdir, "lib", "pkgconfig", NULL);
(gdb) s
g_build_filename (first_element=0x822cc0 "f:\\gstreamer-buildslave\\src\\mingw\\pkg-config-git\\bld\\.libs")
    at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gfileutils.c:2040
2040      va_start (args, first_element);
(gdb) n
2044      str = g_build_pathname_va (first_element, &args, NULL);
(gdb) s
g_build_pathname_va (first_element=0x822cc0 "f:\\gstreamer-buildslave\\src\\mingw\\pkg-config-git\\bld\\.libs", args=0x28fa88, str_array=0x0)
    at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gfileutils.c:1878
1878      gboolean is_first = TRUE;
(gdb) n
1879      gboolean have_leading = FALSE;
(gdb)
1880      const gchar *single_element = NULL;
(gdb)
1882      const gchar *last_trailing = NULL;
(gdb)
1883      gchar current_separator = '\\';
(gdb)
1884      gint i = 0;
(gdb)
1886      result = g_string_new (NULL);
(gdb) s
g_string_new (init=0x0) at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gstring.c:146
146       if (init == NULL || *init == '\0')
(gdb) n
147         string = g_string_sized_new (2);
(gdb) s
g_string_sized_new (dfl_size=2) at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gstring.c:121
121       GString *string = g_slice_new (GString);
(gdb) s
g_slice_alloc (mem_size=12) at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gslice.c:981
981       tmem = thread_memory_from_self ();
(gdb) s
thread_memory_from_self () at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gslice.c:500
500       ThreadMemory *tmem = g_private_get (&private_thread_memory);
(gdb) s
g_private_get (key=0x441478) at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gthread-win32.c:387
387       return TlsGetValue (g_private_get_impl (key));
(gdb) s
g_private_get_impl (key=0x441478) at f:/gstreamer-buildslave/src/mingw/pkg-config-git/pkg-config-git-d11df7ffe030d8282d62fcc2727f609a85910f2a/glib/glib/gthread-win32.c:339
339       DWORD impl = (DWORD) key->p;
(gdb) s
341       if G_UNLIKELY (impl == 0)
(gdb)
343           EnterCriticalSection (&g_private_lock);
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x77bd8dc9 in ntdll!TpCallbackMayRunLong () from C:\Windows\system32\ntdll.dll
(gdb) bt
#0  0x77bd8dc9 in ntdll!TpCallbackMayRunLong () from C:\Windows\system32\ntdll.dll
#1  0x0048b41c in g_private_destructors ()
#2  0x0048b420 in g_private_lock ()
#3  0x00440020 in prefix_variable ()
#4  0x00000000 in ?? ()
(gdb)


More information about the pkg-config mailing list