[PATCH][W32] W32 and MSys compatibility

Dan Nicholson dbn.lists at gmail.com
Mon May 21 05:37:54 PDT 2012


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?

--
Dan


More information about the pkg-config mailing list