Re: [BUGS] 8.0.0beta1: -lpthread missing

Lists: pgsql-bugspgsql-patchespgsql-www
From: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: 8.0.0beta1: -lpthread missing
Date: 2004-08-10 09:14:56
Message-ID: 41189210.4040104@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.4.18) : Linux 2.4.21-grsec
(Debian)

PostgreSQL version (example: PostgreSQL-8.0): PostgreSQL-8.0.0-beta1

Compiler used (example: gcc 2.95.2) : 2.95.4

Please enter a FULL description of your problem:
------------------------------------------------
When configuring --enable-thread-safety the binaries cannot be linked:
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations initdb.o dirmod.o exe
c.o -L../../../src/interfaces/libpq -lpq -L../../../src/port
-Wl,-rpath,/opt/postgresql-800beta1/li
b -lpgport -lz -lreadline -lcrypt -lresolv -lnsl -ldl -lm -o initdb
../../../src/interfaces/libpq/libpq.so: undefined reference to
`pthread_getspecific'
../../../src/interfaces/libpq/libpq.so: undefined reference to
`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).

Regards,
Martin


From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: 8.0.0beta1: -lpthread missing
Date: 2004-08-10 18:53:36
Message-ID: 200408101453.36209.xzilla@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

On Tuesday 10 August 2004 05:14, Martin Münstermann wrote:
> System Configuration
> ---------------------
> Architecture (example: Intel Pentium) : Intel Pentium
>
> Operating System (example: Linux 2.4.18) : Linux 2.4.21-grsec
> (Debian)
>
> PostgreSQL version (example: PostgreSQL-8.0): PostgreSQL-8.0.0-beta1
>
> Compiler used (example: gcc 2.95.2) : 2.95.4
>
>
> Please enter a FULL description of your problem:
> ------------------------------------------------
> When configuring --enable-thread-safety the binaries cannot be linked:
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations initdb.o dirmod.o exe
> c.o -L../../../src/interfaces/libpq -lpq -L../../../src/port
> -Wl,-rpath,/opt/postgresql-800beta1/li
> b -lpgport -lz -lreadline -lcrypt -lresolv -lnsl -ldl -lm -o initdb
> ../../../src/interfaces/libpq/libpq.so: undefined reference to
> `pthread_getspecific'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to
> `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

--
Robert Treat
Build A Better Lamp :: Linux Apache {middleware} PostgreSQL


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

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

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.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


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


In fact, backup in the output and look at the flags used to build libpq.
Are they correct? If they are, you shouldn't need any additional flags
when building initdb because initdb doesn't call any threaded functions,
_except_ if you have that limitation that a libpq using threads requries
a thread flag for everything that calls libpq.

Please report back.

---------------------------------------------------------------------------

Robert Treat wrote:
> On Tuesday 10 August 2004 05:14, Martin M?nstermann wrote:
> > System Configuration
> > ---------------------
> > Architecture (example: Intel Pentium) : Intel Pentium
> >
> > Operating System (example: Linux 2.4.18) : Linux 2.4.21-grsec
> > (Debian)
> >
> > PostgreSQL version (example: PostgreSQL-8.0): PostgreSQL-8.0.0-beta1
> >
> > Compiler used (example: gcc 2.95.2) : 2.95.4
> >
> >
> > Please enter a FULL description of your problem:
> > ------------------------------------------------
> > When configuring --enable-thread-safety the binaries cannot be linked:
> > gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> > -Wmissing-declarations initdb.o dirmod.o exe
> > c.o -L../../../src/interfaces/libpq -lpq -L../../../src/port
> > -Wl,-rpath,/opt/postgresql-800beta1/li
> > b -lpgport -lz -lreadline -lcrypt -lresolv -lnsl -ldl -lm -o initdb
> > ../../../src/interfaces/libpq/libpq.so: undefined reference to
> > `pthread_getspecific'
> > ../../../src/interfaces/libpq/libpq.so: undefined reference to
> > `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
>
> --
> Robert Treat
> Build A Better Lamp :: Linux Apache {middleware} PostgreSQL
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


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


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
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 15:54:36
Message-ID: 200408111554.i7BFsa609431@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www


OK, I have some more information. Basically, the config/acx_pthread.m4
manual page (http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html)
says:

NOTE: You are assumed to not only compile your program with these flags,
but also link it with them as well. e.g. you should link with
$PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS

meaning if -lpthread is defined in PTHREAD_CFLAGS, it also has to be
included in the link. Now, from your reports you said -lpthread was in
PTHREAD_CFLAGS, so why isn't it also included in the libpq link line. I
need to see your link line output for libpq.

If I add -g3 in interfaces/libpq/Makefile:

override CFLAGS += $(PTHREAD_CFLAGS) -g3

I see -g3 in the libpq link line:

gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align -D_REENTRANT
-D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -g3 -fpic -shared

^^^
-Wl,-x,-soname,libpq.so.3 fe-auth.o fe-connect.o fe-exec.o fe-misc.o
fe-print.o fe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o
pqsignal.o fe-secure.o dllist.o md5.o ip.o wchar.o encnames.o noblock.o
pgstrcasecmp.o thread.o -L../../../src/port -L/usr/local/lib
-L/usr/contrib/lib -lintl -lssl -lcrypto -lc
-Wl,-rpath,/usr/local/pgsql/lib -o libpq.so.3.2

Do you see similar behavior in Slackware? I assumed all compilers would
use $CFLAGS in their link lines.

---------------------------------------------------------------------------

Martin Mnstermann wrote:
> 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
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


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-12 06:42:15
Message-ID: 411B1147.9000303@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Bruce Momjian wrote:
> OK, I have some more information. Basically, the config/acx_pthread.m4
> manual page (http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.h=
> tml)
> says:
> =09
> NOTE: You are assumed to not only compile your program with these flags,
> but also link it with them as well. e.g. you should link with
> $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
>
> meaning if -lpthread is defined in PTHREAD_CFLAGS, it also has to be
> included in the link. Now, from your reports you said -lpthread was in
> PTHREAD_CFLAGS, so why isn't it also included in the libpq link line. I
> need to see your link line output for libpq.

OK, here are parts of the output from configure --enable-thread-safety
on Debian:
[...]
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... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for cc_r... gcc
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
[...]
--> configure thays, thate the CFLAG -pthread is sufficient.

Makefile.global:
PTHREAD_CFLAGS = -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS
PTHREAD_LIBS =

Let's look what make is doing:
[...]
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -I../../src/port -I../../src/include
-D_GNU_SOURCE -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -c thread.c
ar crs libpgport.a dirmod.o exec.o noblock.o path.o pipe.o pgsleep.o
pgstrcasecmp.o sprompt.o thread.o

[...]

make[2]: Entering directory
`/home/user/checkout/postgresql-8.0.0beta1/src/interfaces'
make[3]: Entering directory
`/home/user/checkout/postgresql-8.0.0beta1/src/interfaces/libpq'
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-auth.o fe-auth.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-connect.o
fe-connect.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-exec.o fe-exec.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-misc.o fe-misc.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-print.o fe-print.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-lobj.o fe-lobj.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-protocol2.o
fe-protocol2.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-protocol3.o
fe-protocol3.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o pqexpbuffer.o
pqexpbuffer.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o pqsignal.o pqsignal.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-secure.o fe-secure.c
rm -f dllist.c && ln -s ../../../src/backend/lib/dllist.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o dllist.o dllist.c
rm -f md5.c && ln -s ../../../src/backend/libpq/md5.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o md5.o md5.c
rm -f ip.c && ln -s ../../../src/backend/libpq/ip.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o ip.o ip.c
rm -f wchar.c && ln -s ../../../src/backend/utils/mb/wchar.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o wchar.o wchar.c
rm -f encnames.c && ln -s ../../../src/backend/utils/mb/encnames.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o encnames.o encnames.c
rm -f noblock.c && ln -s ../../../src/port/noblock.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o noblock.o noblock.c
rm -f pgstrcasecmp.c && ln -s ../../../src/port/pgstrcasecmp.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o pgstrcasecmp.o
pgstrcasecmp.c
rm -f thread.c && ln -s ../../../src/port/thread.c .
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
-D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o thread.o thread.c
ar crs libpq.a `lorder fe-auth.o fe-connect.o fe-exec.o fe-misc.o
fe-print.o fe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o
pqsignal.o fe-secure.o dllist.o md5.o ip.o wchar.o encnames.o noblock.o
pgstrcasecmp.o thread.o | tsort`
ranlib libpq.a
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -shared -Wl,-soname,libpq.so.3
fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o
dllist.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o
-L../../../src/port -lcrypt -lresolv -lnsl
-Wl,-rpath,/opt/postgresql-800beta1/lib -o libpq.so.3.2
rm -f libpq.so.3
ln -s libpq.so.3.2 libpq.so.3
rm -f libpq.so
ln -s libpq.so.3.2 libpq.so
make[3]: Leaving directory
`/home/user/checkout/postgresql-8.0.0beta1/src/interfaces/libpq'

So the shared library is built with "-pthread"
[...]

gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations initdb.o dirmod.o exec.o
-L../../../src/interfaces/libpq -lpq -L../../../src/port
-Wl,-rpath,/opt/postgresql-800beta1/lib -lpgport -lz -lreadline -lcrypt
-lresolv -lnsl -ldl -lm -o initdb

[--> results in linker error as described in the first posting]

The problem can be resolved, if I modify my Makefile.global to
PTHREAD_LIBS = -lpthread

Then libpq.so is built with -lpthread (note the "l"):
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS -fpic -shared -Wl,-soname,libpq.so.3
fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o
dllist.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o
-L../../../src/port -lcrypt -lresolv -lnsl -lpthread
-Wl,-rpath,/opt/postgresql-800beta1/lib -o libpq.so.3.2

The link line of initdb is unchanged, with the difference that there is
no error:
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations initdb.o dirmod.o exec.o
-L../../../src/interfaces/libpq -lpq -L../../../src/port
-Wl,-rpath,/opt/postgresql-800beta1/lib -lpgport -lz -lreadline -lcrypt
-lresolv -lnsl -ldl -lm -o initdb

So for me it looks like in my case it's not sufficient to have the
compiler flag "-pthread", but also (or instead?) the linker flag
"-lpthread".
Maybe the case of a shared library using pthreads is not handled
correctly in the m4 macro?

Regards,
Martin


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


OK, we now have thread compile failure reports on Debian and Slackware.

The config/acx_pthread.m4 script basically tests these:

acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread
-pthreads -mthreads pthread --thread-safe -mt pthread-config"

in that order and exits once it finds the first one that can
compile/link this:

AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])

Now, the big question is why -pthread can compile/link this successfully
but -pthread isn't enough to build a library that uses threads.

I just ran some tests on Debian 3.0 using Sourceforge's compile farm:

$ uname -a
Linux usf-cf-alpha-linux-1 2.2.20 #2 Wed Mar 20 19:57:28 EST 2002 alpha
unknown
$ cat x.c
main()
{
x2();
}
$ cat x2.c
#include <pthread.h>
x2()
{
pthread_t th;
pthread_key_t tkey;

pthread_join(th, 0);
pthread_attr_init(0);
pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0);
pthread_cleanup_pop(0);
}
$ gcc -pthread -shared -Wl,-soname,x2 -o x2.so x2.c
$ gcc -o x x.c x2.so
x2.so: undefined reference to `pthread_create'
x2.so: undefined reference to `_pthread_cleanup_pop'
x2.so: undefined reference to `_pthread_cleanup_push'
x2.so: undefined reference to `pthread_join'
collect2: ld returned 1 exit status
$ # add -lpthread to lib
$ gcc -pthread -shared -Wl,-soname,x2 -o x2.so x2.c -lpthread
$ gcc -o x x.c x2.so
$ # add -pthread to binary
$ gcc -pthread -shared -Wl,-soname,x2 -o x2.so x2.c
$ gcc -pthread -o x x.c x2.so
$

This shows your issue exactly. Now, if I change x2.c to be main() and
use -pthread there:

$ cat x2.c
#include <pthread.h>
main()
{
pthread_t th;
pthread_key_t tkey;

pthread_join(th, 0);
pthread_attr_init(0);
pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0);
pthread_cleanup_pop(0);
}
$ gcc -pthread -o x2 x2.c

it works, which is the test that is being done in config/acx_pthread.m4.

The basic problem is that the test script is testing for building
binaries with certain flags, not for building libraries that use
threads. This works fine for ecpg but not for libpq.

We can't just go and add -pthread to all the binary builds that use
libpq because we would then require user-built apps to also use that
flag too. We need to focus on building libpq properly so we don't need
anything special for building binaries using libpq.

So, this works:

$ gcc -shared -Wl,-soname,x2 -o x2.so x2.c -lpthread
$ gcc -o x x.c x2.so

while this does not:

$ gcc -pthread -shared -Wl,-soname,x2 -o x2.so x2.c
$ gcc -o x x.c x2.so
x2.so: undefined reference to `pthread_create'
x2.so: undefined reference to `_pthread_cleanup_pop'
x2.so: undefined reference to `_pthread_cleanup_push'
x2.so: undefined reference to `pthread_join'
collect2: ld returned 1 exit status

so if we just reordered the list of items in acx_pthread_flags and put
'pthread' first, your platform would work.

It is almost as though -pthread is ignored when making a shared lib; it
builds a shared object file that references threads fine without it:

$ gcc -shared -Wl,-soname,x2 -o x2.so x2.c
$ gcc -pthread -o x x.c x2.so

and that might be the core of the problem.

What I have done is to take a more agressive approach to the thread
flags than the script supported. Instead of exiting once the first
binary is built, the code will now use as many flags as posssible while
still building the binary. On your platform, that will mean -pthread
and -lpthread will be used.

Patch attached and applied.

---------------------------------------------------------------------------

Martin Mnstermann wrote:
> Bruce Momjian wrote:
> > OK, I have some more information. Basically, the config/acx_pthread.m4
> > manual page (http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.h=
> > tml)
> > says:
> > =09
> > NOTE: You are assumed to not only compile your program with these flags,
> > but also link it with them as well. e.g. you should link with
> > $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
> >
> > meaning if -lpthread is defined in PTHREAD_CFLAGS, it also has to be
> > included in the link. Now, from your reports you said -lpthread was in
> > PTHREAD_CFLAGS, so why isn't it also included in the libpq link line. I
> > need to see your link line output for libpq.
>
> OK, here are parts of the output from configure --enable-thread-safety
> on Debian:
> [...]
> 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... yes
> checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
> checking if more special flags are required for pthreads... no
> checking for cc_r... gcc
> checking pthread.h usability... yes
> checking pthread.h presence... yes
> checking for pthread.h... yes
> [...]
> --> configure thays, thate the CFLAG -pthread is sufficient.
>
> Makefile.global:
> PTHREAD_CFLAGS = -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS
> PTHREAD_LIBS =
>
>
> Let's look what make is doing:
> [...]
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -I../../src/port -I../../src/include
> -D_GNU_SOURCE -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -c thread.c
> ar crs libpgport.a dirmod.o exec.o noblock.o path.o pipe.o pgsleep.o
> pgstrcasecmp.o sprompt.o thread.o
>
> [...]
>
> make[2]: Entering directory
> `/home/user/checkout/postgresql-8.0.0beta1/src/interfaces'
> make[3]: Entering directory
> `/home/user/checkout/postgresql-8.0.0beta1/src/interfaces/libpq'
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-auth.o fe-auth.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-connect.o
> fe-connect.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-exec.o fe-exec.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-misc.o fe-misc.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-print.o fe-print.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-lobj.o fe-lobj.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-protocol2.o
> fe-protocol2.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-protocol3.o
> fe-protocol3.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o pqexpbuffer.o
> pqexpbuffer.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o pqsignal.o pqsignal.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o fe-secure.o fe-secure.c
> rm -f dllist.c && ln -s ../../../src/backend/lib/dllist.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o dllist.o dllist.c
> rm -f md5.c && ln -s ../../../src/backend/libpq/md5.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o md5.o md5.c
> rm -f ip.c && ln -s ../../../src/backend/libpq/ip.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o ip.o ip.c
> rm -f wchar.c && ln -s ../../../src/backend/utils/mb/wchar.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o wchar.o wchar.c
> rm -f encnames.c && ln -s ../../../src/backend/utils/mb/encnames.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o encnames.o encnames.c
> rm -f noblock.c && ln -s ../../../src/port/noblock.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o noblock.o noblock.c
> rm -f pgstrcasecmp.c && ln -s ../../../src/port/pgstrcasecmp.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o pgstrcasecmp.o
> pgstrcasecmp.c
> rm -f thread.c && ln -s ../../../src/port/thread.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -I. -I../../../src/include
> -D_GNU_SOURCE -I../../../src/port -DFRONTEND -c -o thread.o thread.c
> ar crs libpq.a `lorder fe-auth.o fe-connect.o fe-exec.o fe-misc.o
> fe-print.o fe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o
> pqsignal.o fe-secure.o dllist.o md5.o ip.o wchar.o encnames.o noblock.o
> pgstrcasecmp.o thread.o | tsort`
> ranlib libpq.a
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -shared -Wl,-soname,libpq.so.3
> fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o
> fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o
> dllist.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o
> -L../../../src/port -lcrypt -lresolv -lnsl
> -Wl,-rpath,/opt/postgresql-800beta1/lib -o libpq.so.3.2
> rm -f libpq.so.3
> ln -s libpq.so.3.2 libpq.so.3
> rm -f libpq.so
> ln -s libpq.so.3.2 libpq.so
> make[3]: Leaving directory
> `/home/user/checkout/postgresql-8.0.0beta1/src/interfaces/libpq'
>
> So the shared library is built with "-pthread"
> [...]
>
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations initdb.o dirmod.o exec.o
> -L../../../src/interfaces/libpq -lpq -L../../../src/port
> -Wl,-rpath,/opt/postgresql-800beta1/lib -lpgport -lz -lreadline -lcrypt
> -lresolv -lnsl -ldl -lm -o initdb
>
> [--> results in linker error as described in the first posting]
>
>
> The problem can be resolved, if I modify my Makefile.global to
> PTHREAD_LIBS = -lpthread
>
> Then libpq.so is built with -lpthread (note the "l"):
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS -fpic -shared -Wl,-soname,libpq.so.3
> fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o
> fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o
> dllist.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o
> -L../../../src/port -lcrypt -lresolv -lnsl -lpthread
> -Wl,-rpath,/opt/postgresql-800beta1/lib -o libpq.so.3.2
>
>
> The link line of initdb is unchanged, with the difference that there is
> no error:
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations initdb.o dirmod.o exec.o
> -L../../../src/interfaces/libpq -lpq -L../../../src/port
> -Wl,-rpath,/opt/postgresql-800beta1/lib -lpgport -lz -lreadline -lcrypt
> -lresolv -lnsl -ldl -lm -o initdb
>
>
> So for me it looks like in my case it's not sufficient to have the
> compiler flag "-pthread", but also (or instead?) the linker flag
> "-lpthread".
> Maybe the case of a shared library using pthreads is not handled
> correctly in the m4 macro?
>
> Regards,
> Martin
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 4.1 KB

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>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-13 09:50:24
Message-ID: 411C8EE0.50507@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

> OK, we now have thread compile failure reports on Debian and Slackware.
>
> The config/acx_pthread.m4 script basically tests these:
>
> acx_pthread_flags=3D"pthreads none -Kthread -kthread lthread -pthread
> -pthreads -mthreads pthread --thread-safe -mt pthread-config"
> =09
> in that order and exits once it finds the first one that can
> compile/link this:
>
> AC_TRY_LINK([#include <pthread.h>],
> [pthread_t th; pthread_join(th, 0);
> pthread_attr_init(0); pthread_cleanup_push(0, 0);
> pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
> [acx_pthread_ok=3Dyes])
>
> Now, the big question is why -pthread can compile/link this successfully
> but -pthread isn't enough to build a library that uses threads.

I suspect that on Solaris, without "-lpthread" the pthread-stubs in
/usr/lib/libc.so might be called at runtime instead of the functional
ones in libpthread.so.

Could this easily be checked?

Martin


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

Hi!

Martin Münstermann wrote:
>> OK, we now have thread compile failure reports on Debian and Slackware.
>>
>> The config/acx_pthread.m4 script basically tests these:
>>
>> acx_pthread_flags=3D"pthreads none -Kthread -kthread lthread -pthread
>> -pthreads -mthreads pthread --thread-safe -mt pthread-config"
>> =09
>> in that order and exits once it finds the first one that can
>> compile/link this:
>>
>> AC_TRY_LINK([#include <pthread.h>],
>> [pthread_t th; pthread_join(th, 0);
>> pthread_attr_init(0); pthread_cleanup_push(0, 0);
>> pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
>> [acx_pthread_ok=3Dyes])
>>
>> Now, the big question is why -pthread can compile/link this successfully
>> but -pthread isn't enough to build a library that uses threads.
>
>
> I suspect that on Solaris, without "-lpthread" the pthread-stubs in
> /usr/lib/libc.so might be called at runtime instead of the functional
> ones in libpthread.so.
>
> Could this easily be checked?

I can confirm this suspect for Solaris8/gcc 3.2.3.
How to reproduce it:
Add a line like
printf("### NOTE: check_sigpipe_handler called.\n");
to check_sigpipe_handler() in fe-secure.c and rebuild libpq.so.

The line is only dumped out (indicating that check_sigpipe_handler() is
being called), when the library is linked with -lpthread.
Without -lpthread no complains from the compiler or linker, but
check_sigpipe_handler() is not called, because the stub of
pthread_once() in libc.so does nothing.

--> We need -lpthread on solaris, too.

Regards,
Martin


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-13 13:17:37
Message-ID: 200408131317.i7DDHb209607@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Martin Mnstermann wrote:
> Hi!
>
> Martin M?nstermann wrote:
> >> OK, we now have thread compile failure reports on Debian and Slackware.
> >>
> >> The config/acx_pthread.m4 script basically tests these:
> >>
> >> acx_pthread_flags=3D"pthreads none -Kthread -kthread lthread -pthread
> >> -pthreads -mthreads pthread --thread-safe -mt pthread-config"
> >> =09
> >> in that order and exits once it finds the first one that can
> >> compile/link this:
> >>
> >> AC_TRY_LINK([#include <pthread.h>],
> >> [pthread_t th; pthread_join(th, 0);
> >> pthread_attr_init(0); pthread_cleanup_push(0, 0);
> >> pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
> >> [acx_pthread_ok=3Dyes])
> >>
> >> Now, the big question is why -pthread can compile/link this successfully
> >> but -pthread isn't enough to build a library that uses threads.
> >
> >
> > I suspect that on Solaris, without "-lpthread" the pthread-stubs in
> > /usr/lib/libc.so might be called at runtime instead of the functional
> > ones in libpthread.so.
> >
> > Could this easily be checked?
>
> I can confirm this suspect for Solaris8/gcc 3.2.3.
> How to reproduce it:
> Add a line like
> printf("### NOTE: check_sigpipe_handler called.\n");
> to check_sigpipe_handler() in fe-secure.c and rebuild libpq.so.
>
> The line is only dumped out (indicating that check_sigpipe_handler() is
> being called), when the library is linked with -lpthread.
> Without -lpthread no complains from the compiler or linker, but
> check_sigpipe_handler() is not called, because the stub of
> pthread_once() in libc.so does nothing.
>
> --> We need -lpthread on solaris, too.

So the current CVS code is good?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: "Simon(at)2ndquadrant(dot)com" <simon(at)2ndquadrant(dot)com>
To: "PostgreSQL-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Missing Manuals
Date: 2004-08-13 22:28:32
Message-ID: NOEFLCFHBPDAFHEIPGBOMEFLCCAA.simon@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www


Here's the manual pages that went missing a few weeks back....I asked my
secretary to post them through, and she had some success, though that looks
like they were weeded out as spam/viruses.

My continued absence is the result of a truck's surprise attempt to test my
personal capability for crash recovery, which is luckily higher than
expected - though my car was less lucky. :)

I will write this up as SGML soon, though comments are welcome now.

Best Regards, Simon Riggs

Attachment Content-Type Size
pitr75_sect1 application/octet-stream 27.8 KB

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>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-16 15:49:31
Message-ID: 4120D78B.6000300@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Bruce Momjian wrote:
>>--> We need -lpthread on solaris, too.
>
>
> So the current CVS code is good?

No. At least not for solaris8.

configure says:
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for cc_r... gcc
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes

Makefile.global:
PTHREAD_CFLAGS = -pthreads -D_REENTRANT -D_THREAD_SAFE
-D_POSIX_PTHREAD_SEMANTICS
PTHREAD_LIBS =

No -lpthread and the resulting binaries have no dependancy on
libpthread.so, so at runtime only the stubs are being called.

Regards,
Martin


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-16 15:58:49
Message-ID: 200408161558.i7GFwnF18514@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Martin Mnstermann wrote:
> Bruce Momjian wrote:
> >>--> We need -lpthread on solaris, too.
> >
> >
> > So the current CVS code is good?
>
> No. At least not for solaris8.
>
> configure says:
> checking whether pthreads work with -pthread... no
> checking whether pthreads work with -pthreads... yes
> checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
> checking if more special flags are required for pthreads... no
> checking for cc_r... gcc
> checking pthread.h usability... yes
> checking pthread.h presence... yes
> checking for pthread.h... yes
>
>
> Makefile.global:
> PTHREAD_CFLAGS = -pthreads -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS
> PTHREAD_LIBS =
>
> No -lpthread and the resulting binaries have no dependancy on
> libpthread.so, so at runtime only the stubs are being called.

OK, would you send me config.log privately so I can see why it isn't
adding the library? Thanks.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-16 23:42:45
Message-ID: 200408162342.i7GNgjn10186@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www


OK, I found the cause. I forgot to run autoconf after the
config/acx_pthread.m4 updated. I just did so. Please retest. Thanks.

---------------------------------------------------------------------------

Martin Mnstermann wrote:
> Bruce Momjian wrote:
> >>--> We need -lpthread on solaris, too.
> >
> >
> > So the current CVS code is good?
>
> No. At least not for solaris8.
>
> configure says:
> checking whether pthreads work with -pthread... no
> checking whether pthreads work with -pthreads... yes
> checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
> checking if more special flags are required for pthreads... no
> checking for cc_r... gcc
> checking pthread.h usability... yes
> checking pthread.h presence... yes
> checking for pthread.h... yes
>
>
> Makefile.global:
> PTHREAD_CFLAGS = -pthreads -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS
> PTHREAD_LIBS =
>
> No -lpthread and the resulting binaries have no dependancy on
> libpthread.so, so at runtime only the stubs are being called.
>
> Regards,
> Martin
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


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>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-17 07:24:37
Message-ID: 4121B2B5.60807@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Bruce Momjian wrote:
> OK, I found the cause. I forgot to run autoconf after the
> config/acx_pthread.m4 updated. I just did so. Please retest. Thanks.

Ok, I did an cvs update and rerun configure.
Now it gives me an error:

[...]
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... yes
checking for the pthreads library -lpthread... yes
checking whether pthreads work with -mt... yes
checking for the pthreads library -lpthreads... yes
checking whether pthreads work without any flags... yes
checking whether pthreads work with -Kthread... yes
checking whether pthreads work with -kthread... yes
checking for the pthreads library -llthread... yes
checking whether pthreads work with -pthread... yes
checking whether pthreads work with -pthreads... yes
checking whether pthreads work with -mthreads... yes
checking for the pthreads library -lpthread... yes
checking whether pthreads work with --thread-safe... yes
checking whether pthreads work with -mt... yes
checking for joinable pthread attribute... unknown
configure: WARNING: we do not know how to create joinable pthreads

[Oooops.]

checking if more special flags are required for pthreads... no
checking for cc_r... gcc
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for strerror_r... no
checking for getpwuid_r... no
checking for gethostbyname_r... no
checking whether getpwuid_r takes a fifth argument... no
checking whether strerror_r returns int... no
[...]
checking thread safety of required library functions... no
configure: error:
*** Thread test program failed. Your platform is not thread-safe.
*** Check the file 'config.log'for the exact reason.
***
*** You can use the configure option --enable-thread-safety-force
*** to force threads to be enabled. However, you must then run
*** the program in src/tools/thread and add locking function calls
*** to your applications to guarantee thread safety.

Bruce, I will send you my config.log privately.

Regards,
Martin

>
> -------------------------------------------------------------------------=
> --
>
> Martin M=FCnstermann wrote:
>
>>Bruce Momjian wrote:
>>
>>>>--> We need -lpthread on solaris, too.
>>>
>>>=20
>>>=20
>>>So the current CVS code is good?
>>
>>=20
>>No. At least not for solaris8.
>>=20
>>configure says:
>>checking whether pthreads work with -pthread... no
>>checking whether pthreads work with -pthreads... yes
>>checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
>>checking if more special flags are required for pthreads... no
>>checking for cc_r... gcc
>>checking pthread.h usability... yes
>>checking pthread.h presence... yes
>>checking for pthread.h... yes
>>=20
>>=20
>>Makefile.global:
>>PTHREAD_CFLAGS =3D -pthreads -D_REENTRANT -D_THREAD_SAFE=20
>>-D_POSIX_PTHREAD_SEMANTICS
>>PTHREAD_LIBS =3D
>>=20
>>No -lpthread and the resulting binaries have no dependancy on=20
>>libpthread.so, so at runtime only the stubs are being called.
>>=20
>>Regards,
>> Martin
>>=20
>
>


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-17 15:22:01
Message-ID: 200408171522.i7HFM1k04107@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www


OK, I got it working now. Seems the code needed more help to loop than
I though, and of course trying to change it as little as possible caused
me to miss that.

The attached, applied patch properly aggregates the thread flags. The
bad news is that on my platform that needs _no_ thread flags or
libraries I have:

PTHREAD_CFLAGS = -Kthread -kthread -pthread -pthreads
-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
PTHREAD_LIBS =

I assume those are just ignored for portability so I assume we are OK.

---------------------------------------------------------------------------

Martin Mnstermann wrote:
> Bruce Momjian wrote:
> > OK, I found the cause. I forgot to run autoconf after the
> > config/acx_pthread.m4 updated. I just did so. Please retest. Thanks.
>
> Ok, I did an cvs update and rerun configure.
> Now it gives me an error:
>
> [...]
> checking whether pthreads work with -pthread... no
> checking whether pthreads work with -pthreads... yes
> checking for the pthreads library -lpthread... yes
> checking whether pthreads work with -mt... yes
> checking for the pthreads library -lpthreads... yes
> checking whether pthreads work without any flags... yes
> checking whether pthreads work with -Kthread... yes
> checking whether pthreads work with -kthread... yes
> checking for the pthreads library -llthread... yes
> checking whether pthreads work with -pthread... yes
> checking whether pthreads work with -pthreads... yes
> checking whether pthreads work with -mthreads... yes
> checking for the pthreads library -lpthread... yes
> checking whether pthreads work with --thread-safe... yes
> checking whether pthreads work with -mt... yes
> checking for joinable pthread attribute... unknown
> configure: WARNING: we do not know how to create joinable pthreads
>
> [Oooops.]
>
> checking if more special flags are required for pthreads... no
> checking for cc_r... gcc
> checking pthread.h usability... yes
> checking pthread.h presence... yes
> checking for pthread.h... yes
> checking for strerror_r... no
> checking for getpwuid_r... no
> checking for gethostbyname_r... no
> checking whether getpwuid_r takes a fifth argument... no
> checking whether strerror_r returns int... no
> [...]
> checking thread safety of required library functions... no
> configure: error:
> *** Thread test program failed. Your platform is not thread-safe.
> *** Check the file 'config.log'for the exact reason.
> ***
> *** You can use the configure option --enable-thread-safety-force
> *** to force threads to be enabled. However, you must then run
> *** the program in src/tools/thread and add locking function calls
> *** to your applications to guarantee thread safety.
>
>
> Bruce, I will send you my config.log privately.
>
> Regards,
> Martin
>
> >
> > -------------------------------------------------------------------------=
> > --
> >
> > Martin M=FCnstermann wrote:
> >
> >>Bruce Momjian wrote:
> >>
> >>>>--> We need -lpthread on solaris, too.
> >>>
> >>>=20
> >>>=20
> >>>So the current CVS code is good?
> >>
> >>=20
> >>No. At least not for solaris8.
> >>=20
> >>configure says:
> >>checking whether pthreads work with -pthread... no
> >>checking whether pthreads work with -pthreads... yes
> >>checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
> >>checking if more special flags are required for pthreads... no
> >>checking for cc_r... gcc
> >>checking pthread.h usability... yes
> >>checking pthread.h presence... yes
> >>checking for pthread.h... yes
> >>=20
> >>=20
> >>Makefile.global:
> >>PTHREAD_CFLAGS =3D -pthreads -D_REENTRANT -D_THREAD_SAFE=20
> >>-D_POSIX_PTHREAD_SEMANTICS
> >>PTHREAD_LIBS =3D
> >>=20
> >>No -lpthread and the resulting binaries have no dependancy on=20
> >>libpthread.so, so at runtime only the stubs are being called.
> >>=20
> >>Regards,
> >> Martin
> >>=20
> >
> >
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


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>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-19 07:44:43
Message-ID: 41245A6B.3010705@betrusted.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Bruce Momjian wrote:
> OK, I got it working now. Seems the code needed more help to loop than
> I though, and of course trying to change it as little as possible caused
> me to miss that.
>
> The attached, applied patch properly aggregates the thread flags. The
> bad news is that on my platform that needs _no_ thread flags or
> libraries I have:
>
> PTHREAD_CFLAGS =3D -Kthread -kthread -pthread -pthreads
> -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
> PTHREAD_LIBS =3D
>
> I assume those are just ignored for portability so I assume we are OK.

Current CVS is working for Solaris, too.
Compiles and libthread.so is used at runtime. :-)

PTHREAD_CFLAGS = -pthreads -Kthread -kthread -pthread
-pthreads -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
PTHREAD_LIBS = -lpthread -lpthread

The -Kthread -kthread is not needed here, but is included because gcc
3.2 does not treat them as error, but just dumps out "gcc: unrecognized
option `-kthread'".

Regards,
Martin


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Martin Münstermann <mmuenstermann(at)betrusted(dot)com>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] 8.0.0beta1: -lpthread missing
Date: 2004-08-19 16:35:36
Message-ID: 200408191635.i7JGZaT13179@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www

Martin Mnstermann wrote:
> Bruce Momjian wrote:
> > OK, I got it working now. Seems the code needed more help to loop than
> > I though, and of course trying to change it as little as possible caused
> > me to miss that.
> >
> > The attached, applied patch properly aggregates the thread flags. The
> > bad news is that on my platform that needs _no_ thread flags or
> > libraries I have:
> >
> > PTHREAD_CFLAGS =3D -Kthread -kthread -pthread -pthreads
> > -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
> > PTHREAD_LIBS =3D
> >
> > I assume those are just ignored for portability so I assume we are OK.
>
> Current CVS is working for Solaris, too.
> Compiles and libthread.so is used at runtime. :-)
>
> PTHREAD_CFLAGS = -pthreads -Kthread -kthread -pthread
> -pthreads -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
> PTHREAD_LIBS = -lpthread -lpthread
>
> The -Kthread -kthread is not needed here, but is included because gcc
> 3.2 does not treat them as error, but just dumps out "gcc: unrecognized
> option `-kthread'".

Yep, same here. I am hoping we come up with a cleaner solution someday. :-)

But I am thrilled to have this threading all automated now.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Simon(at)2ndquadrant(dot)com" <simon(at)2ndquadrant(dot)com>
Cc: PostgreSQL www <pgsql-www(at)postgresql(dot)org>
Subject: consultant
Date: 2004-09-30 16:37:39
Message-ID: 200409301637.i8UGbdD28377@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs pgsql-patches pgsql-www


Simon, you should get listed on the consulting page for PostgreSQL:

http://techdocs.postgresql.org/companies.php

Just submit your info to the www list. We had someone asking for a
consultant in England and you were not listed.

---------------------------------------------------------------------------

Simon(at)2ndquadrant(dot)com wrote:
>
> Here's the manual pages that went missing a few weeks back....I asked my
> secretary to post them through, and she had some success, though that looks
> like they were weeded out as spam/viruses.
>
> My continued absence is the result of a truck's surprise attempt to test my
> personal capability for crash recovery, which is luckily higher than
> expected - though my car was less lucky. :)
>
> I will write this up as SGML soon, though comments are welcome now.
>
> Best Regards, Simon Riggs
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073