Skip Menu |

This queue is for tickets about the Glib CPAN distribution.

Report information
The Basics
Id: 23510
Status: resolved
Priority: 0/
Queue: Glib

People
Owner: kaffeetisch [...] gmx.de
Requestors: stro [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.141
Fixed in: (no value)



Subject: Compiling on Win32 with MSVC -- G_OS_WIN32 problem in gperl.h
MSVC (obviously) doesn't set G_OS_WIN32, so compiling anything with new (1.141) version of gperl.h will fail. I used attached patch against sources to have it compiled with MSVC7. It still produces testing errors, but it is correct -- I'll file another bug about t/64bit.t under native Win32 environment. -- Serguei Trouchelle
Subject: Glib-1.141-Win32.patch
--- S:\prj\CPAN\builds\Glib-1.141\unpatched\Glib-1.141\gperl.h Sun Nov 19 21:24:46 2006 +++ S:\prj\CPAN\builds\Glib-1.141\gperl.h Mon Nov 20 23:08:42 2006 @@ -34,6 +34,14 @@ # undef free #endif +#ifdef _MSC_VER + /* perl and glib disagree on a few macros... let the wookie win. */ +# undef pipe +# undef malloc +# undef realloc +# undef free +#endif + #include <glib-object.h> /* --- S:\prj\CPAN\builds\Glib-1.141\unpatched\Glib-1.141\GType.xs Sun Nov 19 21:24:46 2006 +++ S:\prj\CPAN\builds\Glib-1.141\GType.xs Mon Nov 20 23:02:28 2006 @@ -690,10 +690,18 @@ =cut +#ifdef _MSC_VER +# include <stdlib.h> +#endif + #ifdef G_OS_WIN32 # define PORTABLE_STRTOLL(str, end, base) strtol (str, end, base) #else -# define PORTABLE_STRTOLL(str, end, base) strtoll (str, end, base) +# ifdef _MSC_VER +# define PORTABLE_STRTOLL(str, end, base) strtoi64 (str, end, base) +# else +# define PORTABLE_STRTOLL(str, end, base) strtoll (str, end, base) +# endif #endif gint64 @@ -741,7 +749,11 @@ #ifdef G_OS_WIN32 # define PORTABLE_STRTOULL(str, end, base) strtoul (str, end, base) #else -# define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base) +# ifdef _MSC_VER +# define PORTABLE_STRTOULL(str, end, base) strtoui64 (str, end, base) +# else +# define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base) +# endif #endif guint64
Thanks a lot for the patch. But as I wrote on the mailing list: Show quoted text
> The problem I tried to fix was that sometimes, WIN32 didn't seem to be > defined while _WIN32 was. To avoid the pre-processor mess, I thought it > was a safe bet to assume that G_OS_WIN32 is defined more correctly and > we were better off just using it. But as it now seems, G_OS_WIN32 > doesn't really live up to that assumption.
So let's just revert the G_OS_WIN32 change. Does the attached patch (slightly modified version of your patch) still work for you? What are the test failures you're seeing?
Index: gperl.h =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/gperl.h,v retrieving revision 1.45 diff -u -d -p -r1.45 gperl.h --- gperl.h 5 Nov 2006 13:20:35 -0000 1.45 +++ gperl.h 21 Nov 2006 22:24:14 -0000 @@ -26,7 +26,7 @@ #include "perl.h" #include "XSUB.h" -#ifdef G_OS_WIN32 +#ifdef WIN32 /* perl and glib disagree on a few macros... let the wookie win. */ # undef pipe # undef malloc Index: GType.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GType.xs,v retrieving revision 1.76 diff -u -d -p -r1.76 GType.xs --- GType.xs 5 Nov 2006 13:20:35 -0000 1.76 +++ GType.xs 21 Nov 2006 22:24:14 -0000 @@ -690,8 +690,16 @@ C<SvIV> instead. =cut -#ifdef G_OS_WIN32 -# define PORTABLE_STRTOLL(str, end, base) strtol (str, end, base) +#ifdef _MSC_VER +# include <stdlib.h> +#endif + +#ifdef WIN32 +# ifdef _MSC_VER +# define PORTABLE_STRTOLL(str, end, base) strtoi64 (str, end, base) +# else +# define PORTABLE_STRTOLL(str, end, base) strtol (str, end, base) +# endif #else # define PORTABLE_STRTOLL(str, end, base) strtoll (str, end, base) #endif @@ -738,8 +746,12 @@ uses C<SvUV> instead. =cut -#ifdef G_OS_WIN32 -# define PORTABLE_STRTOULL(str, end, base) strtoul (str, end, base) +#ifdef WIN32 +# ifdef _MSC_VER +# define PORTABLE_STRTOLL(str, end, base) strtoui64 (str, end, base) +# else +# define PORTABLE_STRTOLL(str, end, base) strtoul (str, end, base) +# endif #else # define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base) #endif
On Tue Nov 21 17:25:37 2006, TSCH wrote: There's typo in this part of patch: -#ifdef G_OS_WIN32 -# define PORTABLE_STRTOULL(str, end, base) strtoul (str, end, base) +#ifdef WIN32 +# ifdef _MSC_VER Show quoted text
>+# define PORTABLE_STRTOLL(str, end, base) strtoui64 (str, end, base)
+# else Show quoted text
>+# define PORTABLE_STRTOLL(str, end, base) strtoul (str, end, base)
+# endif #else # define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base) #endif Should be _STRTOULL instead of _STRTOLL there. Also _strtoui64 and _strtoi64 should have underscores. Then it compiles fine. -- Serguei Trouchelle
Oops. New incarnation attached. Will commit soon.
Index: gperl.h =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/gperl.h,v retrieving revision 1.45 diff -u -d -p -r1.45 gperl.h --- gperl.h 5 Nov 2006 13:20:35 -0000 1.45 +++ gperl.h 22 Nov 2006 18:55:55 -0000 @@ -26,7 +26,7 @@ #include "perl.h" #include "XSUB.h" -#ifdef G_OS_WIN32 +#ifdef WIN32 /* perl and glib disagree on a few macros... let the wookie win. */ # undef pipe # undef malloc Index: GType.xs =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GType.xs,v retrieving revision 1.76 diff -u -d -p -r1.76 GType.xs --- GType.xs 5 Nov 2006 13:20:35 -0000 1.76 +++ GType.xs 22 Nov 2006 18:55:56 -0000 @@ -690,8 +690,16 @@ C<SvIV> instead. =cut -#ifdef G_OS_WIN32 -# define PORTABLE_STRTOLL(str, end, base) strtol (str, end, base) +#ifdef _MSC_VER +# include <stdlib.h> +#endif + +#ifdef WIN32 +# ifdef _MSC_VER +# define PORTABLE_STRTOLL(str, end, base) _strtoi64 (str, end, base) +# else +# define PORTABLE_STRTOLL(str, end, base) strtol (str, end, base) +# endif #else # define PORTABLE_STRTOLL(str, end, base) strtoll (str, end, base) #endif @@ -738,8 +746,12 @@ uses C<SvUV> instead. =cut -#ifdef G_OS_WIN32 -# define PORTABLE_STRTOULL(str, end, base) strtoul (str, end, base) +#ifdef WIN32 +# ifdef _MSC_VER +# define PORTABLE_STRTOULL(str, end, base) _strtoui64 (str, end, base) +# else +# define PORTABLE_STRTOULL(str, end, base) strtoul (str, end, base) +# endif #else # define PORTABLE_STRTOULL(str, end, base) strtoull (str, end, base) #endif
On Wed Nov 22 13:56:16 2006, TSCH wrote: Last diff is fine. I'll try to test it under Cygwin if I have a chance to install it. Show quoted text
> Oops. New incarnation attached. Will commit soon.
-- Serguei Trouchelle
Show quoted text
> I'll try to test it under Cygwin if I have a chance to install it.
Cygwin fails on GBookmarkFile.xs: gcc -c -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I. -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr /local/include -DUSEIMPORTLIB -O3 -DVERSION=\"1.141\" -DXS_VERSION=\"1.141\" -o GBookmarkFile.o "-I/usr/lib/perl5/5.8 /cygwin/CORE" GBookmarkFile.c GBookmarkFile.xs:24: error: parse error before '*' token GBookmarkFile.xs: In function `newSVGBookmarkFile': GBookmarkFile.xs:31: error: `bookmark_file' undeclared (first use in this function) GBookmarkFile.xs:31: error: (Each undeclared identifier is reported only once GBookmarkFile.xs:31: error: for each function it appears in.) GBookmarkFile.xs: At top level: GBookmarkFile.xs:42: error: parse error before '*' token GBookmarkFile.xs: In function `SvGBookmarkFile': GBookmarkFile.xs:48: error: `GBookmarkFile' undeclared (first use in this function) GBookmarkFile.xs:48: error: parse error before ')' token GBookmarkFile.c: In function `XS_Glib__BookmarkFile_DESTROY': GBookmarkFile.c:69: error: `GBookmarkFile' undeclared (first use in this function) GBookmarkFile.c:69: error: `bookmark_file' undeclared (first use in this function) GBookmarkFile.c: In function `XS_Glib__BookmarkFile_new': GBookmarkFile.c:84: error: `GBookmarkFile' undeclared (first use in this function) GBookmarkFile.c:84: error: `RETVAL' undeclared (first use in this function) [... and so on ...] It also fails in the same place in 1.140, so this error is not related to MSVC patch. -- Serguei Trouchelle
On Wed Nov 22 18:07:31 2006, STRO wrote: Show quoted text
> Last diff is fine. > I'll try to test it under Cygwin if I have a chance to install it.
OK, applied to HEAD and the stable-1-14 branch.
Subject: GBookmarkFile.xs doesn't compile on Cygwin
On Wed Nov 22 20:39:54 2006, STRO wrote: Show quoted text
> Cygwin fails on GBookmarkFile.xs: > > gcc -c -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I. > -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr > /local/include -DUSEIMPORTLIB -O3 -DVERSION=\"1.141\" > -DXS_VERSION=\"1.141\" -o GBookmarkFile.o "-I/usr/lib/perl5/5.8 > /cygwin/CORE" GBookmarkFile.c > GBookmarkFile.xs:24: error: parse error before '*' token
Hmm, this looks like gbookmarkfile.h doesn't get included. Does your <prefix>/include/glib-2.0/glib.h contain an include line for glib/gbookmarkfile.h?
From: STRO [...] cpan.org
On Thu Nov 23 13:50:04 2006, TSCH wrote: Show quoted text
> > Cygwin fails on GBookmarkFile.xs: > > > > gcc -c -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I. > > -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr > > /local/include -DUSEIMPORTLIB -O3 -DVERSION=\"1.141\" > > -DXS_VERSION=\"1.141\" -o GBookmarkFile.o "-I/usr/lib/perl5/5.8 > > /cygwin/CORE" GBookmarkFile.c > > GBookmarkFile.xs:24: error: parse error before '*' token
Show quoted text
> Hmm, this looks like gbookmarkfile.h doesn't get included. Does your > <prefix>/include/glib-2.0/glib.h contain an include line for > glib/gbookmarkfile.h?
No, there's no such file at all. Cygwin says that Glib2 has version 2.6.6-2, maybe this is the reason. -- Serguei Trouchelle
From: TSCH [...] cpan.org
On Wed Nov 29 10:02:30 2006, STRO wrote: Show quoted text
> > Hmm, this looks like gbookmarkfile.h doesn't get included. Does your > > <prefix>/include/glib-2.0/glib.h contain an include line for > > glib/gbookmarkfile.h?
> > No, there's no such file at all. Cygwin says that Glib2 has version > 2.6.6-2, maybe this is the reason.
In this case, GBookmarkFile.xs shouldn't really be part of the compile process at all. Glib's Makefile.PL has this if (ExtUtils::PkgConfig->atleast_version ('glib-2.0', '2.11.0')) { push @xs_files, 'GBookmarkFile.xs'; } This boils down to calling pkg-config --atleast-version=2.12.0 glib-2.0 So, unless pkg-config for some reason thinks your glib is >= 2.11.0, you shouldn't see GBookmarkFile.xs at all. What does the Version: field of your <prefix>/lib/pkgconfig/glib-2.0.pc say?
On Wed Nov 29 14:37:58 2006, TSCH wrote: Show quoted text
> > No, there's no such file at all. Cygwin says that Glib2 has version > > 2.6.6-2, maybe this is the reason.
Show quoted text
> In this case, GBookmarkFile.xs shouldn't really be part of the compile > process at all. Glib's Makefile.PL has this > > if (ExtUtils::PkgConfig->atleast_version ('glib-2.0', '2.11.0')) { > push @xs_files, 'GBookmarkFile.xs'; > } > > This boils down to calling > > pkg-config --atleast-version=2.12.0 glib-2.0 > > So, unless pkg-config for some reason thinks your glib is >= 2.11.0, you > shouldn't see GBookmarkFile.xs at all. What does the Version: field of > your <prefix>/lib/pkgconfig/glib-2.0.pc say?
I see... This was my local problem with simultaneous installations of native Win32 Glib2 and Cygwin Glib2, Cygwin's pkgconfig find native's .pc file (which is 2.12.4). After solving this, compilation goes fine -- without errors. So final patch is fine to go, I believe. -- Serguei Trouchelle
Subject: Compiling on Win32 with MSVC -- G_OS_WIN32 problem in gperl.h
OK. The fix was already committed and it will soon appear in a new release.