Re: [Fwd: DBD::Pg on HP-UX 11.31 64bit] - Mailing list pgsql-bugs

From H.Merijn Brand
Subject Re: [Fwd: DBD::Pg on HP-UX 11.31 64bit]
Date
Msg-id 20101220123138.5935920f@pc09.procura.nl
Whole thread Raw
In response to Re: [Fwd: DBD::Pg on HP-UX 11.31 64bit]  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, 16 Dec 2010 12:56:12 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> "H.Merijn Brand" <h.m.brand@xs4all.nl> writes:
> > On Thu, 16 Dec 2010 12:31:21 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> So what I'm thinking is happening is that libpq expects size_t as
> >> the argument type, but it's getting linked against a libc that
> >> expects int as the argument type, and whatever HP is doing under
> >> the hood fails to cope with that case.  You might try removing
> >> -D_XOPEN_SOURCE_EXTENDED from the template file --- I don't know if
> >> that will have any bad side-effects, but it's worth a try to build
> >> libpq that way.
>
> > I'll try that first after cleaning up my environment.
>
> I looked in the git history and found that I added
> -D_XOPEN_SOURCE_EXTENDED in a patch that made getaddrinfo work
> correctly:
> http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=1da6eb7fdaa79a93972c290174bd7136672a894f
> So taking it out may indeed have unpleasant side-effects.

I have read that patch, and it may well be that this might only be
needed on PA-RISC. I at least see that the comment written in
src/makefiles/Makefile.hpux is not completely correct. Probably true
for LP64, but not for IA64.

I hav now taken out the -D_XOPEN_SOURCE_EXTENDED and -lxnet requirements
and compiled postgres against BSD sockets. Now it passes both its
internal test suite *AND* the DBD::Pg test suite.

Side notes

env CC=cc CFLAGS="-Ae -z +Z +DD64 -O2" configure --prefix=/pro/pgsql \
     --without-readline --without-ldap --with-openssl

currently doesn't work, as src/template/hpux and
src/makefiles/Makefile.hpux overrule these env vars, which means that
I still have to modify src/Makefile.global

Note again that I am on HP-UX 11.31 on Itanium (not PA-RISC) and that I
am compiling a 64bitall environment.

 HP-UX 11.31/64 U  rx2660/64 Itanium 2 9100/1710(2) ia64  4075 Mb
 This is perl, v5.10.1 (*) built for IA64.ARCHREV_0-LP64
 /pro/pgsql/bin/psql:    ELF-64 executable object file - IA64
 psql (PostgreSQL) 8.4.5

Below is the diff between what was generated by default on 8.4.5 and
after what I changed to make it work. Note that I did not alter either
the template not the specific original makefile to do so automatically.
I can (try to) do so if you would like to see how I would do that

After make, these are the essential diffs:
--8<---
diff -purd postgresql-8.4.5-org/config.status postgresql-8.4.5/config.status
--- postgresql-8.4.5-org/config.status  2010-12-20 11:52:19 +0100
+++ postgresql-8.4.5/config.status      2010-12-20 12:04:26 +0100
@@ -567,7 +567,7 @@ s,@enable_dtrace@,|#_!!_#|no,g
 s,@CC@,|#_!!_#|cc -Ae,g
 s,@CFLAGS@,|#_!!_#|-Ae -z +Z +DD64 -O2,g
 s,@LDFLAGS@,|#_!!_#| -L/usr/local/ia64/lib -L/usr/lib/hpux64 -L/usr/contrib/X11R6/lib/hpux64 -s -L/usr/local/lib
-L/usr/lib/X11R6-L/usr/contrib/X11R6/lib ,g 
-s,@CPPFLAGS@,|#_!!_#| -D_XOPEN_SOURCE_EXTENDED ,g
+s,@CPPFLAGS@,|#_!!_#| ,g
 s,@ac_ct_CC@,|#_!!_#|,g
 s,@EXEEXT@,|#_!!_#|,g
 s,@OBJEXT@,|#_!!_#|o,g
@@ -981,8 +981,8 @@ s,^\([       #]*\)[^         ]*\([   ]*SIZEOF_OFF_T\)
 s,^\([  #]*\)[^         ]*\([   ]*HAVE_INT_TIMEZONE\)[  (].*,\1define\2  ,
 s,^\([  #]*\)[^         ]*\([   ]*ACCEPT_TYPE_RETURN\)[         (].*,\1define\2 int ,
 s,^\([  #]*\)[^         ]*\([   ]*ACCEPT_TYPE_ARG1\)[   (].*,\1define\2 int ,
-s,^\([  #]*\)[^         ]*\([   ]*ACCEPT_TYPE_ARG2\)[   (].*,\1define\2 struct sockaddr * ,
-s,^\([  #]*\)[^         ]*\([   ]*ACCEPT_TYPE_ARG3\)[   (].*,\1define\2 size_t ,
+s,^\([  #]*\)[^         ]*\([   ]*ACCEPT_TYPE_ARG2\)[   (].*,\1define\2 void * ,
+s,^\([  #]*\)[^         ]*\([   ]*ACCEPT_TYPE_ARG3\)[   (].*,\1define\2 int ,
 s,^\([  #]*\)[^         ]*\([   ]*HAVE_CBRT\)[  (].*,\1define\2 1 ,
 s,^\([  #]*\)[^         ]*\([   ]*HAVE_DLOPEN\)[        (].*,\1define\2 1 ,
 s,^\([  #]*\)[^         ]*\([   ]*HAVE_FCVT\)[  (].*,\1define\2 1 ,
diff -purd postgresql-8.4.5-org/src/Makefile.global postgresql-8.4.5/src/Makefile.global
--- postgresql-8.4.5-org/src/Makefile.global    2010-12-20 11:52:19 +0100
+++ postgresql-8.4.5/src/Makefile.global        2010-12-20 12:05:17 +0100
@@ -199,8 +199,8 @@ DOCBOOK2MAN =

 # Compilers

-CPP = cc -Ae -E
-CPPFLAGS =  -D_XOPEN_SOURCE_EXTENDED
+CPP = cc -E
+CPPFLAGS =

 ifdef PGXS
 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
@@ -211,7 +211,7 @@ override CPPFLAGS := -I$(top_builddir)/s
 endif
 endif # not PGXS

-CC = cc -Ae
+CC = cc
 GCC =
 SUN_STUDIO_CC = no
 CFLAGS = -Ae -z +Z +DD64 -O2
diff -purd postgresql-8.4.5-org/src/Makefile.port postgresql-8.4.5/src/Makefile.port
--- postgresql-8.4.5-org/src/Makefile.port      2010-10-01 15:35:31 +0200
+++ postgresql-8.4.5/src/Makefile.port  2010-12-20 11:58:53 +0100
@@ -8,7 +8,7 @@ endif
 # Using X/Open Networking Interfaces requires to link with libxnet.
 # Without specifying this, bind(), getpeername() and so on don't work
 # correctly in the LP64 data model.
-LIBS := -lxnet $(LIBS)
+#LIBS := -lxnet $(LIBS)

 # Set up rpath so that the executables don't need SHLIB_PATH to be set.
 # (Note: --disable-rpath is a really bad idea on this platform...)
diff -purd postgresql-8.4.5-org/src/include/pg_config.h postgresql-8.4.5/src/include/pg_config.h
--- postgresql-8.4.5-org/src/include/pg_config.h        2010-12-20 11:52:19 +0100
+++ postgresql-8.4.5/src/include/pg_config.h    2010-12-20 12:04:27 +0100
@@ -5,10 +5,10 @@
 #define ACCEPT_TYPE_ARG1 int

 /* Define to the type of arg 2 of 'accept' */
-#define ACCEPT_TYPE_ARG2 struct sockaddr *
+#define ACCEPT_TYPE_ARG2 void *

 /* Define to the type of arg 3 of 'accept' */
-#define ACCEPT_TYPE_ARG3 size_t
+#define ACCEPT_TYPE_ARG3 int

 /* Define to the return type of 'accept' */
 #define ACCEPT_TYPE_RETURN int
diff -purd postgresql-8.4.5-org/src/makefiles/Makefile.hpux postgresql-8.4.5/src/makefiles/Makefile.hpux
--- postgresql-8.4.5-org/src/makefiles/Makefile.hpux    2010-10-01 15:35:31 +0200
+++ postgresql-8.4.5/src/makefiles/Makefile.hpux        2010-12-20 11:58:53 +0100
@@ -8,7 +8,7 @@ endif
 # Using X/Open Networking Interfaces requires to link with libxnet.
 # Without specifying this, bind(), getpeername() and so on don't work
 # correctly in the LP64 data model.
-LIBS := -lxnet $(LIBS)
+#LIBS := -lxnet $(LIBS)

 # Set up rpath so that the executables don't need SHLIB_PATH to be set.
 # (Note: --disable-rpath is a really bad idea on this platform...)
diff -purd postgresql-8.4.5-org/src/template/hpux postgresql-8.4.5/src/template/hpux
--- postgresql-8.4.5-org/src/template/hpux      2010-10-01 15:35:31 +0200
+++ postgresql-8.4.5/src/template/hpux  2010-12-20 11:58:20 +0100
@@ -1,6 +1,6 @@
 # $PostgreSQL: pgsql/src/template/hpux,v 1.16 2006/12/12 19:43:19 petere Exp $

-CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
+#CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"

 if test "$GCC" != yes ; then
   CC="$CC -Ae"
-->8---

--
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.3 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

pgsql-bugs by date:

Previous
From: "Volker"
Date:
Subject: BUG #5796: Problem with history-files
Next
From: Tom Lane
Date:
Subject: Re: BUG #5797: Strange bug with hstore