Thread: pgsql: Add compat file for dynamically loading the functions that MinGW

pgsql: Add compat file for dynamically loading the functions that MinGW

From
mha@postgresql.org (Magnus Hagander)
Date:
Log Message:
-----------
Add compat file for dynamically loading the functions that MinGW is missing
the imports for. Add RegisterWaitForSingleObject() to the list of such
functions, which should take care of the current buildfarm breakage.

Modified Files:
--------------
    pgsql/src/backend/port/win32:
        Makefile (r1.10 -> r1.11)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32/Makefile?r1=1.10&r2=1.11)

Added Files:
-----------
    pgsql/src/backend/port/win32:
        mingwcompat.c (r1.1)

(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32/mingwcompat.c?rev=1.1&content-type=text/x-cvsweb-markup)

mha@postgresql.org (Magnus Hagander) writes:
> Add compat file for dynamically loading the functions that MinGW is missing
> the imports for. Add RegisterWaitForSingleObject() to the list of such
> functions, which should take care of the current buildfarm breakage.

Trivial stylistic complaint: shouldn't the _RegisterWaitForSingleObject
variable be declared static?  IMHO variables (and functions) should
always be static unless there is an explicit intent to access them from
other modules.

            regards, tom lane

Re: pgsql: Add compat file for dynamically loading the functions that MinGW

From
Magnus Hagander
Date:
Tom Lane wrote:
> mha@postgresql.org (Magnus Hagander) writes:
>> Add compat file for dynamically loading the functions that MinGW is missing
>> the imports for. Add RegisterWaitForSingleObject() to the list of such
>> functions, which should take care of the current buildfarm breakage.
>
> Trivial stylistic complaint: shouldn't the _RegisterWaitForSingleObject
> variable be declared static?  IMHO variables (and functions) should
> always be static unless there is an explicit intent to access them from
> other modules.

Yup, it certainly should. Fixing. Thanks.

//Magnus

Re: pgsql: Add compat file for dynamically loading the functions that MinGW

From
"Hiroshi Saito"
Date:
Hi Magnus.

Ooops, error happen by MinGW (gcc)....CVS-HEAD

$ make -s
signal.c: In function `pg_signal_thread':
signal.c:254: warning: unsigned int format, DWORD arg (arg 4)
mingwcompat.c:48: error: syntax error before "WAITORTIMERCALLBACK"
mingwcompat.c:54: error: syntax error before "WAITORTIMERCALLBACK"
mingwcompat.c:58: warning: no previous prototype for 'RegisterWaitForSingleObject'
mingwcompat.c: In function `RegisterWaitForSingleObject':
mingwcompat.c:73: error: `phNewWaitObject' undeclared (first use in this function)
mingwcompat.c:73: error: (Each undeclared identifier is reported only once
mingwcompat.c:73: error: for each function it appears in.)
mingwcompat.c:73: error: `hObject' undeclared (first use in this function)
mingwcompat.c:73: error: `Callback' undeclared (first use in this function)
mingwcompat.c:73: error: `Context' undeclared (first use in this function)
mingwcompat.c:73: error: `dwMilliseconds' undeclared (first use in this function)
mingwcompat.c:73: error: `dwFlags' undeclared (first use in this function)
make[4]: *** [mingwcompat.o] Error 1
make[3]: *** [win32.dir] Error 2
make[2]: *** [port-recursive] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

/END
However, this patch is good.

*** src/backend/port/win32/mingwcompat.c.orig   Wed Oct 31 14:28:51 2007
--- src/backend/port/win32/mingwcompat.c        Wed Oct 31 14:55:43 2007
***************
*** 20,25 ****
--- 20,27 ----
   */
  #ifndef WIN32_ONLY_COMPILER

+ typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK;
+
  static HMODULE kernel32 = NULL;

  /*

Furthermore, .....

make[3]: Entering directory `/home/hiroshi/pgsql/src/backend/postmaster'
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels
 -fno-strict-aliasing -I../../../src/include -I./src/include/port/win32 -DEXEC_BACKEND
"-I../../../src/include/port/win32" -DBUILDING_DLL  -c -o postmaster.o postmaster.c
postmaster.c: In function `internal_forkexec':
postmaster.c:3466: warning: implicit declaration of function `RegisterWaitForSingleObject'
postmaster.c:3471: error: `WT_EXECUTEONLYONCE' undeclared (first use in this function)
postmaster.c:3471: error: (Each undeclared identifier is reported only once
postmaster.c:3471: error: for each function it appears in.)
postmaster.c:3471: error: `WT_EXECUTEINWAITTHREAD' undeclared (first use in this function)
postmaster.c: In function `pgwin32_deadchild_callback':
postmaster.c:4520: warning: implicit declaration of function `UnregisterWaitEx'
make[3]: *** [postmaster.o] Error 1
make[3]: Leaving directory `/home/hiroshi/pgsql/src/backend/postmaster'
make[2]: *** [postmaster-recursive] Error 2
make[2]: Leaving directory `/home/hiroshi/pgsql/src/backend'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/hiroshi/pgsql/src'
make: *** [all] Error 2
/END

Umm, define _WIN32_WINNT 0x0500(c.h) is ignore?_?

Regards,
Hiroshi Saito

From: "Magnus Hagander" <mha@postgresql.org>

> Log Message:
> -----------
> Add compat file for dynamically loading the functions that MinGW is missing
> the imports for. Add RegisterWaitForSingleObject() to the list of such
> functions, which should take care of the current buildfarm breakage.
>
> Modified Files:
> --------------
>    pgsql/src/backend/port/win32:
>        Makefile (r1.10 -> r1.11)
>
> (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32/Makefile?r1=1.10&r2=1.11)
>
> Added Files:
> -----------
>    pgsql/src/backend/port/win32:
>        mingwcompat.c (r1.1)
>
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/win32/mingwcompat.c?rev=1.1&content-type=text/x-cvsweb-markup)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org


Re: pgsql: Add compat file for dynamically loading the functions that MinGW

From
Magnus Hagander
Date:
Hiroshi Saito wrote:
> Hi Magnus.
>
> Ooops, error happen by MinGW (gcc)....CVS-HEAD
>
> $ make -s
> signal.c: In function `pg_signal_thread':
> signal.c:254: warning: unsigned int format, DWORD arg (arg 4)
> mingwcompat.c:48: error: syntax error before "WAITORTIMERCALLBACK"
> mingwcompat.c:54: error: syntax error before "WAITORTIMERCALLBACK"
> mingwcompat.c:58: warning: no previous prototype for
> 'RegisterWaitForSingleObject'
> mingwcompat.c: In function `RegisterWaitForSingleObject':
> mingwcompat.c:73: error: `phNewWaitObject' undeclared (first use in this
> function)
> mingwcompat.c:73: error: (Each undeclared identifier is reported only once
> mingwcompat.c:73: error: for each function it appears in.)
> mingwcompat.c:73: error: `hObject' undeclared (first use in this function)
> mingwcompat.c:73: error: `Callback' undeclared (first use in this function)
> mingwcompat.c:73: error: `Context' undeclared (first use in this function)
> mingwcompat.c:73: error: `dwMilliseconds' undeclared (first use in this
> function)
> mingwcompat.c:73: error: `dwFlags' undeclared (first use in this function)
> make[4]: *** [mingwcompat.o] Error 1
> make[3]: *** [win32.dir] Error 2
> make[2]: *** [port-recursive] Error 2
> make[1]: *** [all] Error 2
> make: *** [all] Error 2
>
> /END
> However, this patch is good.
>
> *** src/backend/port/win32/mingwcompat.c.orig   Wed Oct 31 14:28:51 2007
> --- src/backend/port/win32/mingwcompat.c        Wed Oct 31 14:55:43 2007
> ***************
> *** 20,25 ****
> --- 20,27 ----
>   */
>  #ifndef WIN32_ONLY_COMPILER
>
> + typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK;
> +
>  static HMODULE kernel32 = NULL;
>
>  /*
>
> Furthermore, .....
>
> make[3]: Entering directory `/home/hiroshi/pgsql/src/backend/postmaster'
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
> -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
> -I../../../src/include -I./src/include/port/win32 -DEXEC_BACKEND
> "-I../../../src/include/port/win32" -DBUILDING_DLL  -c -o postmaster.o
> postmaster.c
> postmaster.c: In function `internal_forkexec':
> postmaster.c:3466: warning: implicit declaration of function
> `RegisterWaitForSingleObject'
> postmaster.c:3471: error: `WT_EXECUTEONLYONCE' undeclared (first use in
> this function)
> postmaster.c:3471: error: (Each undeclared identifier is reported only once
> postmaster.c:3471: error: for each function it appears in.)
> postmaster.c:3471: error: `WT_EXECUTEINWAITTHREAD' undeclared (first use
> in this function)
> postmaster.c: In function `pgwin32_deadchild_callback':
> postmaster.c:4520: warning: implicit declaration of function
> `UnregisterWaitEx'
> make[3]: *** [postmaster.o] Error 1
> make[3]: Leaving directory `/home/hiroshi/pgsql/src/backend/postmaster'
> make[2]: *** [postmaster-recursive] Error 2
> make[2]: Leaving directory `/home/hiroshi/pgsql/src/backend'
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/home/hiroshi/pgsql/src'
> make: *** [all] Error 2
> /END
>
> Umm, define _WIN32_WINNT 0x0500(c.h) is ignore?_?
>
> Regards,
> Hiroshi Saito

Grumble. This works perfectly fine on all three mingw installs I've
tested, as well as on all the buildfarm members.

What version of mingw is this? Are you by any chance on a *really* old one?

Do those defines exist in the mingw include files on this one?

//Magnus

Re: pgsql: Add compat file for dynamically loading the functions that MinGW

From
"Hiroshi Saito"
Date:
Hi.

>
> Grumble. This works perfectly fine on all three mingw installs I've
> tested, as well as on all the buildfarm members.
>
> What version of mingw is this? Are you by any chance on a *really* old one?
>
> Do those defines exist in the mingw include files on this one?

Ahh, Yes.
I use version this.

msys-1.0.10
mingw-runtime-3.9
mingw-gcc-3.4.5

Sure, it is not defined.(WT_EXECUTEONLYONCE')..:-(
It seems that a new version is needed shortly.
Which do you recommend?

Regards,
Hiroshi Saito

Re: pgsql: Add compat file for dynamically loading the functions that MinGW

From
Magnus Hagander
Date:
Hiroshi Saito wrote:
> Hi.
>
>>
>> Grumble. This works perfectly fine on all three mingw installs I've
>> tested, as well as on all the buildfarm members.
>>
>> What version of mingw is this? Are you by any chance on a *really* old
>> one?
>>
>> Do those defines exist in the mingw include files on this one?
>
> Ahh, Yes.
> I use version this.
>
> msys-1.0.10
> mingw-runtime-3.9
> mingw-gcc-3.4.5
>
> Sure, it is not defined.(WT_EXECUTEONLYONCE')..:-(
> It seems that a new version is needed shortly.
> Which do you recommend?


Can't seem to find any release notes, but download stats indicate that
runtime-3.9 is from sometime around 2005...

With the latest patch, we work with the current version. If you want to
be able to build 8.2 and earlier, you need to go backwards at least one
version because of the gettimeofday() issue. I think you should be able
to find some version references ni the archives somewhere.

//Magnus

Re: pgsql: Add compat file for dynamically loading the functions that MinGW

From
"Hiroshi Saito"
Date:
Hi.

From: "Magnus Hagander" <magnus@hagander.net>

> Can't seem to find any release notes, but download stats indicate that
> runtime-3.9 is from sometime around 2005...
>
> With the latest patch, we work with the current version. If you want to
> be able to build 8.2 and earlier, you need to go backwards at least one
> version because of the gettimeofday() issue. I think you should be able
> to find some version references ni the archives somewhere.

However, gettimeofday() of 8.2 problem is clear at runtime-3.9.
It did not cause a problem to this patch.....
Then, I understood the essence of the problem.
runtime-3.9 are OK. I checked it. So, w32api-3.10 is changed OK.
But,  runtime-3.9 was upgraded to runtime-3.13.
Anyway, thanks!!

Regards,
Hiroshi Saito