Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] UnixWare/CVS Tip/initdb.c needs to use

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Date: 2004-03-19 15:47:57
Message-ID: 84300000.1079711277@lerlaptop-red.iadfw.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches

--On Friday, March 19, 2004 09:18:03 -0600 Larry Rosenman <ler(at)lerctr(dot)org> 
wrote:

>
>
> --On Friday, March 19, 2004 10:15:56 -0500 Bruce Momjian
> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
>
>>> [moved to -patches because of the patch]
>>>
>>>
>>> --On Friday, March 19, 2004 08:01:53 -0500 Bruce Momjian
>>> <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
>>>
>>> > Larry Rosenman wrote:
>>> >> > I thought that once you include libpthread in libpq, that you don't
>>> >> > have to mention it again then you use libpq.  Is your platform
>>> >> > different somehow in this regard?
>>> >> >
>>> >> > I seem to remember this problem with libcrypt and libpq.  Is this
>>> >> > the same problem?
>>> >> >
>>> >> > I see that initdb is just the first of many /bin programs to be
>>> >> > compiled, so if we have to add the thread lib, we will have to do
>>> >> > it for all the bin programs.  Yikes.  Why wasn't this a problem for
>>> >> > 7.4?
>>> >> 7.4 had initdb as a Shell Script.
>>> >> the 7.4.x libpq didn't have any pthread_* references in it, that I
>>> >> see on my box.
>>> >
>>> > Ah, yes.  We added the thread-local storage to handle SIGPIPE.  The
>>> > problem is that initdb isn't the only place.  If you comment out
>>> > initdb from the Makefile in src/bin, does the next make fail too?  I
>>> > bet it does.
>>>
>>> Apparently, because of the way the wrappers work, having -lpthread on
>>> libpq.so does NOT add it to the NEEDED list.
>>>
>>> I made the following patch, and all compiles now:
>>
>> Yes, I was afraid of that.  Is there any way to make it work?  If not,
>> evey libpq program you create will need -lpthread added.
> I think we need to mention if you --enable-thread-safety you MUST use
> -lpthread on UnixWare, at least.  I don't know about other platforms.
>
> I'll ask the compiler guys, but I suspect we're going to have to do it
> this way.
>
 From the Compiler Guys:

 The a.out (not any library) should be linked with -Kpthread (not 
-lpthread).
This will force libthread to be linked in the right order relative to
libc, libC, networking libraries, etc.

In other words, the entire application either is or is not linked with
threads; it's not a property of an individual library.


SO, IF we are using the threads flags, we need to use them on ALL 
libpq-using programs, ours or the users.

Not surprising.

LER

-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2004-03-19 15:49:30
Subject: Re: COPY formatting
Previous:From: Richard HuxtonDate: 2004-03-19 15:28:56
Subject: Re: Question on restoring and compiled plans

pgsql-patches by date

Next:From: Bruce MomjianDate: 2004-03-19 15:55:53
Subject: Re: [HACKERS] UnixWare/CVS Tip/initdb.c needs to use threads
Previous:From: Larry RosenmanDate: 2004-03-19 15:18:02
Subject: Re: [HACKERS] UnixWare/CVS Tip/initdb.c needs to use

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group