FAQ
(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

Search Discussions

  • Matt England at Mar 6, 2006 at 4:36 pm
    Hi Merrill et al,
    At 3/6/2006 10:25 AM, Merrill Cornish wrote:
    Are you using C++? If so, checkout the Boost threads library
    (www.boost.org). Boost's goal is portability across compilers and
    OSes. In the case of threads, it will use whatever threads library,
    including pthreads, are on the local system.
    Thanks for the tip. Yes, my project is C++ based, and we use Boost
    extensively (and not just for threads). We have begun to use Boost threads
    as an implementation of our internal process-thread "wrapper" (we were
    previously only using ACE <http://www.cs.wustl.edu/~schmidt/ACE.html>).

    However, I don't see how our usage of Boost in my project's code is going
    to get around the postgresql-8.1.3 build problems under mingw as per my
    original email. Maybe I'm missing something?

    -Matt
  • Matt England at Mar 6, 2006 at 10:08 pm

    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
  • Matt England at Mar 6, 2006 at 10:13 pm

    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

    $
  • Matt England at Mar 6, 2006 at 11:11 pm

    At 3/6/2006 04:29 PM, Earnie Boyd wrote:
    Quoting Matt England <[email protected]>:
    $ 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 [email protected] 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
  • Matt England at Mar 7, 2006 at 1:48 am

    At 3/6/2006 05:11 PM, Matt England wrote:
    At 3/6/2006 04:29 PM, Earnie Boyd wrote:
    Quoting Matt England <[email protected]>:
    $ 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 [email protected] 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-ports @
categoriespostgresql
postedMar 6, '06 at 4:15p
activeMar 7, '06 at 1:48a
posts6
users1
websitepostgresql.org
irc#postgresql

1 user in discussion

Matt England: 6 posts

People

Translate

site design / logo © 2023 Grokbase