Threading fix for AIX

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Zeugswetter Andreas DAZ SD <ZeugswetterA(at)spardat(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andrew Sullivan <ajs(at)crankycanuck(dot)ca>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Threading fix for AIX
Date: 2004-12-14 12:48:06
Message-ID: 200412141248.iBECm6c10442@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Zeugswetter Andreas DAZ SD wrote:
>
> >> However, one thing we can do is to try this in Makefile.aix:
> >> # AIX needs threads for everything that uses libpq
> >> LIBS += $(PTHREAD_LIBS)
> >> That is going to enable thread libs for all linking including the
> >> backend, but it might work.
>
> > That is certainly wrong. The correct thing is to add PTHREAD_LIBS to
> > all and only those links that include libpq. I suspect that the cc_r
>
> You mean like attached patch ? That is safe and can be applied.
> My machine has problems with two configure tests with --enable-thread-safety.
>
> 1. the snprintf long long int check that uses int64 as variable name which is
> a typedef in sys/inttypes.h

I changed it to ac_int64. Does that help?

> 2. whether strerror_r returns int check fails with a redefine of named function
> from string.h

I see. Our test is:

int strerror_r(int, char *, size_t);

but AIX is:

int strerror_r(int, char *, int);

OK, I added an #ifndef _AIX to use 'int' for the 3rd arg for AIX.

> No idea how to fix those, but workaround is easy :-(
>
> -lpthread can be removed from PTHREAD_LIBS, the lib is a compat symlink to
> -lpthreads, I guess it does not hurt eighter.

Yea, that is an effect of the tests we use and accumulate flags rather
than taking the first one that works. The test tests compiling but
creating libraries that use threads actually needs more than one flag on
some platforms so we just take all flags we can.

It would be nice if your fix also helped unixware but that needs
compilere flags for any thread library usage and we don't have
centralized libpq-specific compiler flags like we have library flags.

Please test this patch and report back. 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

Attachment Content-Type Size
unknown_filename text/plain 6.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2004-12-14 13:16:01 Re: rc1 packaged ...
Previous Message strk 2004-12-14 11:24:01 Re: join selectivity

Browse pgsql-patches by date

  From Date Subject
Next Message hyip 2004-12-14 12:48:20 Re: Optional REFERENCES Feature in CREATE TRIGGER Command
Previous Message Peter Eisentraut 2004-12-14 11:10:19 Re: small typo in create user --help