Re: [PATCHES] win32 libpq build broken
Patch applied. Thanks. --- Magnus Hagander wrote: > by the change to gettext. Needs a bunch of new includes. Patch follows: > > > diff -c -r1.13 win32.c > *** win32.c 22 Feb 2005 04:42:20 - 1.13 > --- win32.c 27 Feb 2005 17:36:06 - > *** > *** 19,26 > > /* Make stuff compile faster by excluding not used stuff */ > > - #define WIN32_LEAN_AND_MEAN > - #define WIN32_EXTRA_LEAN > #define VC_EXTRALEAN > #ifndef __MINGW32__ > #define NOGDI > --- 19,24 > *** > *** 31,36 > --- 29,37 > #include > #include > #include "win32.h" > + #include "postgres_fe.h" > + #include "libpq-fe.h" > + #include "libpq-int.h" > > static struct WSErrorEntry > { > -- Bruce Momjian| http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 8: explain analyze is your friend
[PATCHES] win32 libpq build broken
by the change to gettext. Needs a bunch of new includes. Patch follows: diff -c -r1.13 win32.c *** win32.c 22 Feb 2005 04:42:20 - 1.13 --- win32.c 27 Feb 2005 17:36:06 - *** *** 19,26 /* Make stuff compile faster by excluding not used stuff */ - #define WIN32_LEAN_AND_MEAN - #define WIN32_EXTRA_LEAN #define VC_EXTRALEAN #ifndef __MINGW32__ #define NOGDI --- 19,24 *** *** 31,36 --- 29,37 #include #include #include "win32.h" + #include "postgres_fe.h" + #include "libpq-fe.h" + #include "libpq-int.h" static struct WSErrorEntry { ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] Win32 libpq/ssl fix
Patch applied. Thanks. --- Dave Page wrote: > The Win32 (mingw) build of libpq seems to have lost it's SSL libs from > the link step resulting in a build failure. The attached patch fixes > that. > > Please apply asap. > > Thanks, Dave Content-Description: libpq_ssl.patch [ Attachment, skipping... ] > > ---(end of broadcast)--- > TIP 8: explain analyze is your friend -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
[PATCHES] Win32 libpq/ssl fix
The Win32 (mingw) build of libpq seems to have lost it's SSL libs from the link step resulting in a build failure. The attached patch fixes that. Please apply asap. Thanks, Dave libpq_ssl.patch Description: libpq_ssl.patch ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [PATCHES] win32 libpq ENABLE_THREAD_SAFETY
Patch applied. Thanks. I updated the comments at the top of win32.mak too to document this new option. I also made some changes so our Win32 native port can use threads too. I need to modify the configure tests but for now the attached applied patch will set up the groundwork for it. Mingw does support threads, right? --- Andreas Pflug wrote: > So here's the updated ENABLE_THREAD_SAFETY patch for win32, to be > compiled under VC5/6/7 (tested with VC6). > > nmake -f win32.mak [DEBUG=1] [USE_SSL=1] [ENABLE_THREAD_SAFETY=1] > > are supported. > > Regards, > Andreas > > /*- > * > * pthread-win32.c > *partial pthread implementation for win32 > * > * Copyright (c) 2004, PostgreSQL Global Development Group > * IDENTIFICATION > * $PostgreSQL: $ > * > *- > */ > > > #include "windows.h" > #include "pthread.h" > > HANDLE pthread_self() > { >return GetCurrentThread(); > } > > void pthread_setspecific(pthread_key_t key, void *val) > { > } > > void *pthread_getspecific(pthread_key_t key) > { > return NULL; > } > > void pthread_mutex_init(pthread_mutex_t *mp, void *attr) > { >*mp = CreateMutex(0, 0, 0); > } > > void pthread_mutex_lock(pthread_mutex_t *mp) > { >WaitForSingleObject(*mp, INFINITE); > } > > void pthread_mutex_unlock(pthread_mutex_t *mp) > { >ReleaseMutex(*mp); > } > #ifndef __PTHREAD_H > #define __PTHREAD_H > > typedef ULONG pthread_key_t; > typedef HANDLE pthread_mutex_t; > typedef int pthread_once_t; > > HANDLE pthread_self(); > > void pthread_setspecific(pthread_key_t, void*); > void* pthread_getspecific(pthread_key_t); > > void pthread_mutex_init(pthread_mutex_t *, void *attr); > void pthread_mutex_lock(pthread_mutex_t*); // blocking > void pthread_mutex_unlock(pthread_mutex_t*); > > #endif > Index: interfaces/libpq/fe-connect.c > === > RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v > retrieving revision 1.274 > diff -u -r1.274 fe-connect.c > --- interfaces/libpq/fe-connect.c 10 Jun 2004 22:26:24 - 1.274 > +++ interfaces/libpq/fe-connect.c 13 Jun 2004 19:13:58 - > @@ -882,11 +882,13 @@ > const char *node = NULL; > int ret; > #ifdef ENABLE_THREAD_SAFETY > +#ifndef WIN32 > static pthread_once_t check_sigpipe_once = PTHREAD_ONCE_INIT; > > /* Check only on first connection request */ > pthread_once(&check_sigpipe_once, check_sigpipe_handler); > #endif > +#endif > > if (!conn) > return 0; > @@ -3183,11 +3185,19 @@ > } > > static pgthreadlock_t default_threadlock; > + > static void > default_threadlock(int acquire) > { > #ifdef ENABLE_THREAD_SAFETY > +#ifndef WIN32 > static pthread_mutex_t singlethread_lock = PTHREAD_MUTEX_INITIALIZER; > +#else > + static pthread_mutex_t singlethread_lock; > +static long mutex_initialized = 0; > +if (!InterlockedExchange(&mutex_initialized, 1L)) > +pthread_mutex_init(&singlethread_lock, NULL); > +#endif > if (acquire) > pthread_mutex_lock(&singlethread_lock); > else > Index: interfaces/libpq/fe-secure.c > === > RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/fe-secure.c,v > retrieving revision 1.41 > diff -u -r1.41 fe-secure.c > --- interfaces/libpq/fe-secure.c 3 Jun 2004 00:13:19 - 1.41 > +++ interfaces/libpq/fe-secure.c 13 Jun 2004 19:14:00 - > @@ -864,8 +864,14 @@ > init_ssl_system(PGconn *conn) > { > #ifdef ENABLE_THREAD_SAFETY > -static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; > - > +#ifndef WIN32 > +static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; > +#else > +static pthread_mutex_t init_mutex; > +static long mutex_initialized = 0L; > +if (!InterlockedExchange(&mutex_initialized, 1L)) > +pthread_mutex_init(&init_mutex, NULL); > +#endif > pthread_mutex_lock(&init_mutex); > > if (pq_initssllib && pq_lockarray == NULL) { > @@ -1171,6 +1177,7 @@ > > > #ifdef ENABLE_THREAD_SAFETY > +#ifndef WIN32 > /* > * Check SIGPIPE handler and perhaps install our own. > */ > @@ -1210,6 +1217,7 @@ > if (!PQinSend()) > exit(128 + SIGPIPE);/* typical return value for SIG_DFL */ > } > +#endif > #endif > > /* > Index: interfaces/libpq/win32.mak > === > RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/win32.mak,v > retrieving revision 1.24 > diff -u -r1.24 win32.mak > --- interfaces/libpq/win32.mak4 Jun 2004 13:30:04 - 1.24 > +++ inter
[PATCHES] win32 libpq ENABLE_THREAD_SAFETY
So here's the updated ENABLE_THREAD_SAFETY patch for win32, to be compiled under VC5/6/7 (tested with VC6). nmake -f win32.mak [DEBUG=1] [USE_SSL=1] [ENABLE_THREAD_SAFETY=1] are supported. Regards, Andreas /*- * * pthread-win32.c *partial pthread implementation for win32 * * Copyright (c) 2004, PostgreSQL Global Development Group * IDENTIFICATION * $PostgreSQL: $ * *- */ #include "windows.h" #include "pthread.h" HANDLE pthread_self() { return GetCurrentThread(); } void pthread_setspecific(pthread_key_t key, void *val) { } void *pthread_getspecific(pthread_key_t key) { return NULL; } void pthread_mutex_init(pthread_mutex_t *mp, void *attr) { *mp = CreateMutex(0, 0, 0); } void pthread_mutex_lock(pthread_mutex_t *mp) { WaitForSingleObject(*mp, INFINITE); } void pthread_mutex_unlock(pthread_mutex_t *mp) { ReleaseMutex(*mp); } #ifndef __PTHREAD_H #define __PTHREAD_H typedef ULONG pthread_key_t; typedef HANDLE pthread_mutex_t; typedef int pthread_once_t; HANDLE pthread_self(); void pthread_setspecific(pthread_key_t, void*); void* pthread_getspecific(pthread_key_t); void pthread_mutex_init(pthread_mutex_t *, void *attr); void pthread_mutex_lock(pthread_mutex_t*); // blocking void pthread_mutex_unlock(pthread_mutex_t*); #endif Index: interfaces/libpq/fe-connect.c === RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v retrieving revision 1.274 diff -u -r1.274 fe-connect.c --- interfaces/libpq/fe-connect.c 10 Jun 2004 22:26:24 - 1.274 +++ interfaces/libpq/fe-connect.c 13 Jun 2004 19:13:58 - @@ -882,11 +882,13 @@ const char *node = NULL; int ret; #ifdef ENABLE_THREAD_SAFETY +#ifndef WIN32 static pthread_once_t check_sigpipe_once = PTHREAD_ONCE_INIT; /* Check only on first connection request */ pthread_once(&check_sigpipe_once, check_sigpipe_handler); #endif +#endif if (!conn) return 0; @@ -3183,11 +3185,19 @@ } static pgthreadlock_t default_threadlock; + static void default_threadlock(int acquire) { #ifdef ENABLE_THREAD_SAFETY +#ifndef WIN32 static pthread_mutex_t singlethread_lock = PTHREAD_MUTEX_INITIALIZER; +#else + static pthread_mutex_t singlethread_lock; +static long mutex_initialized = 0; +if (!InterlockedExchange(&mutex_initialized, 1L)) +pthread_mutex_init(&singlethread_lock, NULL); +#endif if (acquire) pthread_mutex_lock(&singlethread_lock); else Index: interfaces/libpq/fe-secure.c === RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/fe-secure.c,v retrieving revision 1.41 diff -u -r1.41 fe-secure.c --- interfaces/libpq/fe-secure.c3 Jun 2004 00:13:19 - 1.41 +++ interfaces/libpq/fe-secure.c13 Jun 2004 19:14:00 - @@ -864,8 +864,14 @@ init_ssl_system(PGconn *conn) { #ifdef ENABLE_THREAD_SAFETY -static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; - +#ifndef WIN32 +static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; +#else +static pthread_mutex_t init_mutex; +static long mutex_initialized = 0L; +if (!InterlockedExchange(&mutex_initialized, 1L)) +pthread_mutex_init(&init_mutex, NULL); +#endif pthread_mutex_lock(&init_mutex); if (pq_initssllib && pq_lockarray == NULL) { @@ -1171,6 +1177,7 @@ #ifdef ENABLE_THREAD_SAFETY +#ifndef WIN32 /* * Check SIGPIPE handler and perhaps install our own. */ @@ -1210,6 +1217,7 @@ if (!PQinSend()) exit(128 + SIGPIPE);/* typical return value for SIG_DFL */ } +#endif #endif /* Index: interfaces/libpq/win32.mak === RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/win32.mak,v retrieving revision 1.24 diff -u -r1.24 win32.mak --- interfaces/libpq/win32.mak 4 Jun 2004 13:30:04 - 1.24 +++ interfaces/libpq/win32.mak 13 Jun 2004 19:14:01 - @@ -74,21 +74,25 @@ [EMAIL PROTECTED] "$(OUTDIR)\$(OUTFILENAME)dll.lib" [EMAIL PROTECTED] "$(INTDIR)\wchar.obj" [EMAIL PROTECTED] "$(INTDIR)\encnames.obj" + [EMAIL PROTECTED] "$(INTDIR)\pthread-win32.obj" -config: ..\..\include\pg_config.h pg_config_paths.h +config: ..\..\include\pg_config.h pthread.h pg_config_paths.h ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32 copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h +pthread.h: pthread.h.win32 + copy pthread.h.win32 pthread.h + pg_config_paths.h: win32.mak echo #define SYSCONFDIR "" >pg_config_paths.h "$(OUTDIR)" :
[PATCHES] win32 libpq
The attached patch allows libpq to be compiled under native win32. It adds the missing thread.c. Additionally, it corrects the option to compile for debugging. Regards, Andreas RCS file: /projects/cvsroot/pgsql-server/src/include/pg_config.h.win32,v retrieving revision 1.11 diff -u -r1.11 pg_config.h.win32 --- pg_config.h.win32 12 Jun 2003 08:15:29 - 1.11 +++ pg_config.h.win32 24 Aug 2003 18:26:16 - @@ -60,4 +60,9 @@ #include #endif +#include + +/* getpwuid doesn't exist under win32 */ +#define getpwuid(uid) NULL + #endif /* pg_config_h_win32__ */ RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/win32.mak,v retrieving revision 1.18 diff -u -r1.18 win32.mak --- win32.mak 12 Jun 2003 08:15:29 - 1.18 +++ win32.mak 24 Aug 2003 18:03:43 - @@ -8,7 +8,7 @@ !MESSAGE !IFDEF DEBUG -OPT=/Od +OPT=/Od /Zi LOPT=/debug DEBUGDEF=/D _DEBUG !ELSE @@ -26,12 +26,16 @@ CPP=cl.exe RSC=rc.exe +!IFDEF DEBUG +OUTDIR=.\Debug +INTDIR=.\Debug +CPP_OBJS=.\Debug/ +!ELSE OUTDIR=.\Release INTDIR=.\Release +CPP_OBJS=.\Release/ +!ENDIF -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros ALL : "$(OUTDIR)\libpq.lib" "$(OUTDIR)\libpq.dll" @@ -72,16 +76,15 @@ "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\ /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP" -CPP_OBJS=.\Release/ CPP_SBRS=. LIB32=link.exe -lib LIB32_FLAGS=$(LOPT) /nologo /out:"$(OUTDIR)\libpq.lib" LIB32_OBJS= \ - "$(OUTDIR)\win32.obj" \ + "$(INTDIR)\win32.obj" \ "$(INTDIR)\getaddrinfo.obj" \ "$(INTDIR)\inet_aton.obj" \ - "$(INTDIR)\crypt.obj" \ +"$(INTDIR)\crypt.obj" \ "$(INTDIR)\path.obj" \ "$(INTDIR)\dllist.obj" \ "$(INTDIR)\md5.obj" \ @@ -94,6 +97,7 @@ "$(INTDIR)\fe-lobj.obj" \ "$(INTDIR)\fe-misc.obj" \ "$(INTDIR)\fe-print.obj" \ + "$(INTDIR)\thread.obj" \ "$(INTDIR)\fe-secure.obj" \ "$(INTDIR)\pqexpbuffer.obj" \ "$(INTDIR)\wchar.obj" \ @@ -126,38 +130,43 @@ $(LINK32_FLAGS) $(LINK32_OBJS) << -"$(OUTDIR)\getaddrinfo.obj" : ..\..\port\getaddrinfo.c +"$(INTDIR)\getaddrinfo.obj" : ..\..\port\getaddrinfo.c $(CPP) @<< $(CPP_PROJ) ..\..\port\getaddrinfo.c << -"$(OUTDIR)\inet_aton.obj" : ..\..\port\inet_aton.c +"$(INTDIR)\thread.obj" : ..\..\port\thread.c +$(CPP) @<< +$(CPP_PROJ) ..\..\port\thread.c +<< + +"$(INTDIR)\inet_aton.obj" : ..\..\port\inet_aton.c $(CPP) @<< $(CPP_PROJ) ..\..\port\inet_aton.c << -"$(OUTDIR)\crypt.obj" : ..\..\port\crypt.c +"$(INTDIR)\crypt.obj" : ..\..\port\crypt.c $(CPP) @<< $(CPP_PROJ) ..\..\port\crypt.c << -"$(OUTDIR)\path.obj" : ..\..\port\path.c +"$(INTDIR)\path.obj" : ..\..\port\path.c $(CPP) @<< $(CPP_PROJ) ..\..\port\path.c << -"$(OUTDIR)\dllist.obj" : ..\..\backend\lib\dllist.c +"$(INTDIR)\dllist.obj" : ..\..\backend\lib\dllist.c $(CPP) @<< $(CPP_PROJ) ..\..\backend\lib\dllist.c << -"$(OUTDIR)\md5.obj" : ..\..\backend\libpq\md5.c +"$(INTDIR)\md5.obj" : ..\..\backend\libpq\md5.c $(CPP) @<< $(CPP_PROJ) ..\..\backend\libpq\md5.c << -"$(OUTDIR)\ip.obj" : ..\..\backend\libpq\ip.c +"$(INTDIR)\ip.obj" : ..\..\backend\libpq\ip.c $(CPP) @<< $(CPP_PROJ) ..\..\backend\libpq\ip.c << ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster