Thread: building 7.4.3 on Solaris 9/Intel

building 7.4.3 on Solaris 9/Intel

From
"David Parker"
Date:
Hi. I'm trying to build 7.4.3 on Solaris 9/Intel (gcc 3.2.2), and I get
the following:

========================================================================
================
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -fPIC -I. -I../../../src/include  -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS -DFRONTEND
-DSYSCONFDIR='"/home/dparker/servers/install/i386/etc/postgresql"'  -c
-o thread.o thread.c
thread.c: In function `pqGetpwuid':
thread.c:119: too few arguments to function `getpwuid_r'
========================================================================
================

This is the code from thread.c:

========================================================================
================
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) &&
defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)

#ifdef GETPWUID_R_5ARG
    /* POSIX version */
    getpwuid_r(uid, resultbuf, buffer, buflen, result);
#else
    /*
     * Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
     *    getpwuid_r(uid, resultbuf, buffer, buflen)
     */
    *result = getpwuid_r(uid, resultbuf, buffer, buflen);
#endif
#else
========================================================================
================

The check for getpwuid_r in configure appeared to work OK, but it looks
like the POSIX version of getpwuid_r is not being called. Is there some
other switch I need to pass to configure to get that GETPWUID_R_5ARG
defined? This is what I get in pg_config.h:

========================================================================
================
/* Define to 1 to build client libraries as thread-safe code.
   (--enable-thread-safety) */
#define ENABLE_THREAD_SAFETY 1

/* Define to 1 if getpwuid_r() takes a 5th argument. */
/* #undef GETPWUID_R_5ARG */
========================================================================
================

Thanks. Any clues appreciated.

-  DAP
======================================================
David Parker    Tazz Networks    (401) 709-5130



Re: building 7.4.3 on Solaris 9/Intel

From
jseymour@linxnet.com (Jim Seymour)
Date:
"David Parker" <dparker@tazznetworks.com> wrote:
>
> Hi. I'm trying to build 7.4.3 on Solaris 9/Intel (gcc 3.2.2), and I get
> the following:
>
> ========================================================================
> ================
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -fPIC -I. -I../../../src/include  -D_REENTRANT
> -D_POSIX_PTHREAD_SEMANTICS -DFRONTEND
> -DSYSCONFDIR='"/home/dparker/servers/install/i386/etc/postgresql"'  -c
> -o thread.o thread.c
> thread.c: In function `pqGetpwuid':
> thread.c:119: too few arguments to function `getpwuid_r'
> ========================================================================
> ================
[snip]

7.4.3?  Are you sure?  This should be fixed in 7.4.3.

From an earlier reply I made to somebody in the [ADMIN] mailing
list, regarding trying to build 7.4.2 on Solaris 8:

This is fixed in CVS.  Or you can apply this patch

    http://jimsun.linxnet.com/misc/pgsql-7.4.2.patch

to a freshly-extracted 7.4.2 tarball (*before* running configure).

Standard Disclaimer: No warranties, express or implied.

I'm running 7.4.2 on both a Sparc Solaris 7 and a Sparc Solaris 8
machine, with that patch.

Jim

Re: building 7.4.3 on Solaris 9/Intel

From
"David Parker"
Date:
Thanks for the response. Yup, I'm sure it's 7.4.3.

From the config.log, it looks like the check for getpwuid_r test program
uses -D_POSIX_PTHREAD_SEMANTICS, which turns on the POSIX version of the
call, but the check for "fifth argument" test compile doesn't include
this define, so it fails, and the GETPWUID_R_5ARG doesn't get set:

configure:13411: checking for getpwuid_r
configure:13454: gcc -o conftest -O2 -fno-strict-aliasing -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS   -Wl,-i,-z,defs,-z,
ignore,-z,lazyload  conftest.c -lz -lrt -lresolv -lgen -lsocket -lnsl
-ldl -lm  -lpthread >&5
configure:13457: $? = 0
configure:13460: test -s conftest
configure:13463: $? = 0
configure:13473: result: yes
configure:13411: checking for gethostbyname_r
configure:13454: gcc -o conftest -O2 -fno-strict-aliasing -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS   -Wl,-i,-z,defs,-z,
ignore,-z,lazyload  conftest.c -lz -lrt -lresolv -lgen -lsocket -lnsl
-ldl -lm  -lpthread >&5
configure:13457: $? = 0
configure:13460: test -s conftest
configure:13463: $? = 0
configure:13473: result: yes
configure:13485: checking whether getpwuid_r takes a fifth argument
configure:13515: gcc -c -O2 -fno-strict-aliasing   conftest.c >&5
configure: In function `main':
configure:13507: too many arguments to function `getpwuid_r'

Once I #defined the variable in pg_config.h, everything compiled fine,
of course, but one shouldn't have to....

- DAP

-----Original Message-----
From: Jim Seymour [mailto:jseymour@linxnet.com]
Sent: Tuesday, June 15, 2004 4:38 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] building 7.4.3 on Solaris 9/Intel

"David Parker" <dparker@tazznetworks.com> wrote:
>
> Hi. I'm trying to build 7.4.3 on Solaris 9/Intel (gcc 3.2.2), and I
> get the following:
>
> ======================================================================
> ==
> ================
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations -fPIC -I. -I../../../src/include  -D_REENTRANT
> -D_POSIX_PTHREAD_SEMANTICS -DFRONTEND
> -DSYSCONFDIR='"/home/dparker/servers/install/i386/etc/postgresql"'  -c

> -o thread.o thread.c
> thread.c: In function `pqGetpwuid':
> thread.c:119: too few arguments to function `getpwuid_r'
> ======================================================================
> ==
> ================
[snip]

7.4.3?  Are you sure?  This should be fixed in 7.4.3.

From an earlier reply I made to somebody in the [ADMIN] mailing list,
regarding trying to build 7.4.2 on Solaris 8:

This is fixed in CVS.  Or you can apply this patch

    http://jimsun.linxnet.com/misc/pgsql-7.4.2.patch

to a freshly-extracted 7.4.2 tarball (*before* running configure).

Standard Disclaimer: No warranties, express or implied.

I'm running 7.4.2 on both a Sparc Solaris 7 and a Sparc Solaris 8
machine, with that patch.

Jim

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


Re: building 7.4.3 on Solaris 9/Intel

From
jseymour@linxnet.com (Jim Seymour)
Date:
"David Parker" <dparker@tazznetworks.com> wrote:
>
> Thanks for the response. Yup, I'm sure it's 7.4.3.
>
> From the config.log, it looks like the check for getpwuid_r test program
> uses -D_POSIX_PTHREAD_SEMANTICS, which turns on the POSIX version of the
> call, but the check for "fifth argument" test compile doesn't include
> this define, so it fails, and the GETPWUID_R_5ARG doesn't get set:
[snip]

So it's actually a configure problem.

Jim

Re: building 7.4.3 on Solaris 9/Intel

From
"David Parker"
Date:
Seems to be, which is why I originally asked about configure switches,
but it seems like just
--enable-thread-safety ought to be enough.

-----Original Message-----
From: Jim Seymour [mailto:jseymour@linxnet.com]
Sent: Tuesday, June 15, 2004 5:41 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] building 7.4.3 on Solaris 9/Intel

"David Parker" <dparker@tazznetworks.com> wrote:
>
> Thanks for the response. Yup, I'm sure it's 7.4.3.
>
> From the config.log, it looks like the check for getpwuid_r test
> program uses -D_POSIX_PTHREAD_SEMANTICS, which turns on the POSIX
> version of the call, but the check for "fifth argument" test compile
> doesn't include this define, so it fails, and the GETPWUID_R_5ARG
doesn't get set:
[snip]

So it's actually a configure problem.

Jim

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Re: building 7.4.3 on Solaris 9/Intel

From
Bruce Momjian
Date:
OK, I have fixed this so the configure test happens with the proper
thread flags.  Patch attached, and it will be in 7.4.4.

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

David Parker wrote:
> Seems to be, which is why I originally asked about configure switches,
> but it seems like just
> --enable-thread-safety ought to be enough.
>
> -----Original Message-----
> From: Jim Seymour [mailto:jseymour@linxnet.com]
> Sent: Tuesday, June 15, 2004 5:41 PM
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] building 7.4.3 on Solaris 9/Intel
>
> "David Parker" <dparker@tazznetworks.com> wrote:
> >
> > Thanks for the response. Yup, I'm sure it's 7.4.3.
> >
> > From the config.log, it looks like the check for getpwuid_r test
> > program uses -D_POSIX_PTHREAD_SEMANTICS, which turns on the POSIX
> > version of the call, but the check for "fifth argument" test compile
> > doesn't include this define, so it fails, and the GETPWUID_R_5ARG
> doesn't get set:
> [snip]
>
> So it's actually a configure problem.
>
> Jim
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.310.2.10
diff -c -c -r1.310.2.10 configure
*** configure    8 Jun 2004 15:36:34 -0000    1.310.2.10
--- configure    16 Jun 2004 03:14:51 -0000
***************
*** 13482,13489 ****
  fi
  done

! CFLAGS="$_CFLAGS"
! LIBS="$_LIBS"
  echo "$as_me:$LINENO: checking whether getpwuid_r takes a fifth argument" >&5
  echo $ECHO_N "checking whether getpwuid_r takes a fifth argument... $ECHO_C" >&6
  if test "${pgac_func_getpwuid_r_5arg+set}" = set; then
--- 13482,13488 ----
  fi
  done

! # do this test with the proper thread flags
  echo "$as_me:$LINENO: checking whether getpwuid_r takes a fifth argument" >&5
  echo $ECHO_N "checking whether getpwuid_r takes a fifth argument... $ECHO_C" >&6
  if test "${pgac_func_getpwuid_r_5arg+set}" = set; then
***************
*** 13543,13548 ****
--- 13542,13549 ----

  fi

+ CFLAGS="$_CFLAGS"
+ LIBS="$_LIBS"
  fi


Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.301.2.8
diff -c -c -r1.301.2.8 configure.in
*** configure.in    8 Jun 2004 15:36:35 -0000    1.301.2.8
--- configure.in    16 Jun 2004 03:14:53 -0000
***************
*** 1059,1067 ****
  CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
  LIBS="$LIBS $THREAD_LIBS"
  AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
  CFLAGS="$_CFLAGS"
  LIBS="$_LIBS"
- PGAC_FUNC_GETPWUID_R_5ARG
  fi


--- 1059,1068 ----
  CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
  LIBS="$LIBS $THREAD_LIBS"
  AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
+ # do this test with the proper thread flags
+ PGAC_FUNC_GETPWUID_R_5ARG
  CFLAGS="$_CFLAGS"
  LIBS="$_LIBS"
  fi



Re: building 7.4.3 on Solaris 9/Intel

From
"David Parker"
Date:
Thanks!

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: Tuesday, June 15, 2004 11:49 PM
To: David Parker
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] building 7.4.3 on Solaris 9/Intel


OK, I have fixed this so the configure test happens with the proper
thread flags.  Patch attached, and it will be in 7.4.4.

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

David Parker wrote:
> Seems to be, which is why I originally asked about configure switches,

> but it seems like just --enable-thread-safety ought to be enough.
>
> -----Original Message-----
> From: Jim Seymour [mailto:jseymour@linxnet.com]
> Sent: Tuesday, June 15, 2004 5:41 PM
> To: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] building 7.4.3 on Solaris 9/Intel
>
> "David Parker" <dparker@tazznetworks.com> wrote:
> >
> > Thanks for the response. Yup, I'm sure it's 7.4.3.
> >
> > From the config.log, it looks like the check for getpwuid_r test
> > program uses -D_POSIX_PTHREAD_SEMANTICS, which turns on the POSIX
> > version of the call, but the check for "fifth argument" test compile

> > doesn't include this define, so it fails, and the GETPWUID_R_5ARG
> doesn't get set:
> [snip]
>
> So it's actually a configure problem.
>
> Jim
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html
>

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