Re: 8.0.0beta1: -lpthread missing

From: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: 8.0.0beta1: -lpthread missing
Date: 2004-08-11 07:56:12
Message-ID: 4119D11C.5010206@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches pgsql-www

Hello!

Bruce Momjian wrote:
> Robert Treat wrote:
>
>>>`pthread_once'
>>>../../../src/interfaces/libpq/libpq.so: undefined reference to
>>>`pthread_key_create'
>>>../../../src/interfaces/libpq/libpq.so: undefined reference to
>>>`pthread_setspecific'
>>>collect2: ld returned 1 exit status
>>>
>>>
>>>
>>>Please describe a way to repeat the problem. Please try to provide a
>>>concise reproducible example, if at all possible:
>>>----------------------------------------------------------------------
>>># ./configure --prefix=/opt/postgresql-800beta1 --enable-thread-safety
>>># make
>>>
>>>
>>>If you know how this problem might be fixed, list the solution below:
>>>---------------------------------------------------------------------
>>>The binaries must be linked with pthread (-lpthread).
>>>
>>
>>Can you take a look at the thread below and report back if that fixes your
>>problem? http://archives.postgresql.org/pgsql-hackers/2004-08/msg00525.php

Yes, adding -lpthread to PTHREAD_LIBS and rebuilding solved the problem.
Note: when doing so, libpq.so is built with -lpthread, PTHREAD_LIBS is
*not* used in the makefiles of the client binaries like initdb and psql.

> I looked at that. The line that does the tests is in
> config/acx_pthread.m4:
>
> acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread
> -pthreads -mthreads pthread --thread-safe -mt pthread-conf ig"
>
> so you should see that list tried. Does that help?
>
> I am majorly concerned that Slackware has the same problem as Unixware,
> meaning that if you use threading in the lib, you now need the flags on
> every applicaiton that uses the lib.

At least on debian this is not the case (see above):
-lpthread is used when building libpq.so.3.2.
So the shared library contains a dependency on libpthread.so.
Then the client apps do not need a -lpthread at build time. The dynamic
linker will resolve the dependency on libpthread.so (via libpq.so) at
runtime.

Regards,
Martin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Adam Witney 2004-08-11 08:04:46 Re: OSX problem with make check...
Previous Message Kris Jurka 2004-08-11 06:58:32 Re: Notifications in JDBC driver not correct for V3 protocol

Browse pgsql-patches by date

  From Date Subject
Next Message Gary Doades 2004-08-11 08:42:13 Re: PITR on Win32 - Archive and Restore
Previous Message Andrew Francis 2004-08-11 07:09:27 libpq build problem with <io.h> on MS VC++ 7.0

Browse pgsql-www by date

  From Date Subject
Next Message Dave Page 2004-08-11 07:57:05 Re: PGSQL-WINDOWS mailing list?
Previous Message Josh Berkus 2004-08-11 03:41:00 Re: Event item duplication