Обсуждение: How to build thread-safe postgresql 8.x on mingw?

Поиск
Список
Период
Сортировка

How to build thread-safe postgresql 8.x on mingw?

От
Matt England
Дата:
(I'm cross-posting this to pgsql-ports and mingw-users; I hope that's ok.)

Summary:

I'm trying to get posgresql-base-8.1.3 to build on my mingw/msys (1.0.11
system; uname -a below) using "thread safety."

Am I going to need something like
<http://sources.redhat.com/pthreads-win32/> to accomplish this task?  Is
this *only* alternative; are there any options?

(I don't yet know about how I'm going to distribute this software, ie, how
the library relationships will work b/w pthreads-win32 and postgresql, but
I'll figure it out or report back here if I can't.  Any tips/pointers are
welcome. I plan to follow LGPL to the letter if I do this.)


Details:

$ ./configure --enable-thread-safety --prefix=/cgrid/local/postgresql
--without-zlib

[...]
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
checking for the pthreads library -lpthreadGC2... no
checking pthread.h usability... no
checking pthread.h presence... no
checking for pthread.h... no
configure: error: pthread.h not found, required for --enable-thread-safety

$ uname -a
MINGW32_NT-5.1 MATTS-LAPTOP 1.0.11(0.46/3/2) 2004-04-30 18:55 i686 unknown

I found:

http://sources.redhat.com/pthreads-win32/

as per:

http://sourceforge.net/mailarchive/message.php?msg_id=11243465

-Matt


Re: [Mingw-users] How to build thread-safe postgresql 8.x on

От
Matt England
Дата:
At 3/6/2006 01:53 PM, Earnie Boyd wrote:
>My guess on this is that you've not installed pthreads library in the
>/mingw path.

Where do I get this?  Is there a mingw pthreads library that comes separately?

For what it's worth, I built <http://sources.redhat.com/pthreads-win32/>
and put the corresponding headers in /mingw/include and the libs in /mingw/lib.

...and the postgresql 8.1.3 ./configure --enable-thread-safety now works,
and I'm now 5-10 minutes into the make process...and I have my fingers crossed.

-Matt


Re: How to build thread-safe postgresql 8.x on mingw?

От
Matt England
Дата:
At 3/6/2006 04:07 PM, Matt England wrote:
>For what it's worth, I built <http://sources.redhat.com/pthreads-win32/>
>and put the corresponding headers in /mingw/include and the libs in /mingw/lib.
>
>...and the postgresql 8.1.3 ./configure --enable-thread-safety now works,
>and I'm now 5-10 minutes into the make process...and I have my fingers crossed.

So I spoke too quickly.  My postgresql build broke with "pthreads"
link-time errors.  Details below.

I'm still investigating.  I'd really like to find a mingw/msys "native"
pthreads gizmo.  Not sure how I get/build that stuff, looking for pointers.

-Matt

$ make
[...]
dlltool --export-all  --output-def ecpg.def execute.o typename.o
descriptor.o data.o error.o prepare.o memory.o connect.o misc.o path.o
exec.o snprintf.o
dllwrap  -o libecpg.dll --dllname libecpg.dll  --def ecpg.def execute.o
typename.o descriptor.o data.o error.o prepare.o memory.o connect.o misc.o
path.o exec.o snprintf.o -L../pgtypeslib -L../../../../src/interfaces/libpq
-L../../../../src/port -lpgtypes -lpq -lm -lshfolder
connect.o:connect.c:(.text+0x15): undefined reference to
`_imp__pthread_key_create'
connect.o:connect.c:(.text+0x7a): undefined reference to
`_imp__pthread_getspecific'
connect.o:connect.c:(.text+0xf1): undefined reference to
`_imp__pthread_getspecific'
connect.o:connect.c:(.text+0x11f): undefined reference to
`_imp__pthread_mutex_lock'
connect.o:connect.c:(.text+0x135): undefined reference to
`_imp__pthread_mutex_unlock'
connect.o:connect.c:(.text+0x1da): undefined reference to
`_imp__pthread_getspecific'
connect.o:connect.c:(.text+0x269): undefined reference to
`_imp__pthread_setspecific'
connect.o:connect.c:(.text+0x42e): undefined reference to
`_imp__pthread_setspecific'
connect.o:connect.c:(.text+0x735): undefined reference to
`_imp__pthread_mutex_lock'
connect.o:connect.c:(.text+0x77f): undefined reference to `_imp__pthread_once'
connect.o:connect.c:(.text+0x796): undefined reference to
`_imp__pthread_setspecific'
connect.o:connect.c:(.text+0x872): undefined reference to
`_imp__pthread_mutex_unlock'
connect.o:connect.c:(.text+0x922): undefined reference to
`_imp__pthread_mutex_lock'
connect.o:connect.c:(.text+0x9b0): undefined reference to
`_imp__pthread_mutex_unlock'
connect.o:connect.c:(.text+0xe2e): undefined reference to
`_imp__pthread_mutex_lock'
connect.o:connect.c:(.text+0xe67): undefined reference to
`_imp__pthread_mutex_unlock'
connect.o:connect.c:(.text+0xea5): undefined reference to
`_imp__pthread_mutex_unlock'
misc.o:misc.c:(.text+0x68): undefined reference to `_imp__pthread_key_create'
misc.o:misc.c:(.text+0x89): undefined reference to `_imp__pthread_once'
misc.o:misc.c:(.text+0x97): undefined reference to `_imp__pthread_getspecific'
misc.o:misc.c:(.text+0xcd): undefined reference to `_imp__pthread_setspecific'
misc.o:misc.c:(.text+0x1e8): undefined reference to `_imp__pthread_mutex_lock'
misc.o:misc.c:(.text+0x262): undefined reference to
`_imp__pthread_mutex_unlock'
misc.o:misc.c:(.text+0x28b): undefined reference to `_imp__pthread_mutex_lock'
misc.o:misc.c:(.text+0x2ba): undefined reference to
`_imp__pthread_mutex_unlock'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
make[4]: *** [libecpg.a] Error 1
make[4]: Leaving directory

`e:/data.online/data.cleversafe/svnwork/swdev-external-src/postgresql/dist/mingw/postgresql-8.1.3/src/interfaces/ecpg/ecpglib'
make[3]: *** [all] Error 2
make[3]: Leaving directory
`e:/data.online/data.cleversafe/svnwork/swdev-external-src/postgresql/dist/mingw/postgresql-8.1.3/src/interfaces/ecpg'
make[2]: *** [all] Error 2
make[2]: Leaving directory
`e:/data.online/data.cleversafe/svnwork/swdev-external-src/postgresql/dist/mingw/postgresql-8.1.3/src/interfaces'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`e:/data.online/data.cleversafe/svnwork/swdev-external-src/postgresql/dist/mingw/postgresql-8.1.3/src'
make: *** [all] Error 2

$


Re: [Mingw-users] Re: How to build thread-safe postgresql 8.x

От
Matt England
Дата:
At 3/6/2006 04:29 PM, Earnie Boyd wrote:
>Quoting Matt England <mengland@mengland.net>:
>$ make
>>[...]
>>dlltool --export-all  --output-def ecpg.def execute.o typename.o
>>descriptor.o data.o error.o prepare.o memory.o connect.o misc.o path.o
>>exec.o snprintf.o
>>dllwrap  -o libecpg.dll --dllname libecpg.dll  --def ecpg.def execute.o
>>typename.o descriptor.o data.o error.o prepare.o memory.o connect.o
>>misc.o path.o exec.o snprintf.o -L../pgtypeslib
>>-L../../../../src/interfaces/libpq -L../../../../src/port -lpgtypes -lpq
>>-lm -lshfolder
>
>Where is -lpthreads?

I don't know.  I'm cross-posting to the pgsql-ports@postgresql.org list
with these messages, but I haven't seen a message from them yet.

I'm not sure how I get they to insert a -lpthreads besides manually
changing their Makefile(s).  Anybody know of a way to do this from
postgres' configure line?

-Matt


Re: [Mingw-users] Re: How to build thread-safe postgresql 8.x

От
Matt England
Дата:
At 3/6/2006 05:11 PM, Matt England wrote:
>At 3/6/2006 04:29 PM, Earnie Boyd wrote:
>>Quoting Matt England <mengland@mengland.net>:
>>$ make
>>>[...]
>>>dlltool --export-all  --output-def ecpg.def execute.o typename.o
>>>descriptor.o data.o error.o prepare.o memory.o connect.o misc.o path.o
>>>exec.o snprintf.o
>>>dllwrap  -o libecpg.dll --dllname libecpg.dll  --def ecpg.def execute.o
>>>typename.o descriptor.o data.o error.o prepare.o memory.o connect.o
>>>misc.o path.o exec.o snprintf.o -L../pgtypeslib
>>>-L../../../../src/interfaces/libpq -L../../../../src/port -lpgtypes -lpq
>>>-lm -lshfolder
>>
>>Where is -lpthreads?
>
>I don't know.  I'm cross-posting to the pgsql-ports@postgresql.org list
>with these messages, but I haven't seen a message from them yet.
>
>I'm not sure how I get they to insert a -lpthreads besides manually
>changing their Makefile(s).  Anybody know of a way to do this from
>postgres' configure line?

It helps if one names the library created by
<http://sources.redhat.com/pthreads-win32/> as /mingw/lib/libpthreads.a
...instead of using the native file name created in the pthreads-win32
build (and for the record, copy the 3 Pre-built/include header files from
pthreads-win32 into /mingw/include).

So I did that, and the make process now tells me:

"All of PostgreSQL successfully made. Ready to install."

*whew*

-Matt