PATCH at the end and attached ... I have a system - and so do most of my customers with the same architecture - where the base system has postgres installed.
But alas, it is version 7. That will not do. Their install is in /opt, but as it is *system* postgress, they decided to link /opt/.../libpg.so to /usr/lib/hpux64, which is the default $LD_LIBRARY_PATH of every single user on the system. I set POSTGRES_HOME to /pro/pgsql, which is a symlink to the postgres version I am currently building against (e.g. /pro/pgsql-8.4.3). I do have several to match what is installed at the customer. They all have the /pro/pgsql symlink, so I can rest assured that the libs are found whatever version I build when distributing. When I set POSTGRES_HOME and POSTGRES_LIB (POSTGRES_INCLUDE setting does not propagate into the binary, so I accept the return value of App::Info), the *compilation* works fine, with just 2 warnings: DBD-Pg-2.17.1 > env POSTGRES_HOME=/pro/pgsql POSTGRES_LIB=/pro/pgsql/lib perl Makefile.PL Configuring DBD::Pg 2.17.1 PostgreSQL version: 80403 (default port: 5432) POSTGRES_HOME: /pro/pgsql POSTGRES_INCLUDE: /pro/pgsql-8.4.3/include POSTGRES_LIB: /pro/pgsql/lib OS: hpux Using DBI 1.615 (for perl 5.010001 on IA64.ARCHREV_0-LP64) installed in /pro/lib/perl5/site_perl/5.10.1/IA64.ARCHREV_0-LP64/auto/DBI/ Writing Makefile for DBD::Pg DBD-Pg-2.17.1 > make cp lib/Bundle/DBD/Pg.pm blib/lib/Bundle/DBD/Pg.pm cp Pg.pm blib/lib/DBD/Pg.pm /pro/bin/perl -p -e "s/~DRIVER~/Pg/g; s/^do\(/dontdo\(/" /pro/lib/perl5/site_perl/5.10.1/IA64.ARCHREV_0-LP64/auto/DBI/Driver.xst > Pg.xsi /pro/bin/perl /pro/lib/perl5/5.10.1/ExtUtils/xsubpp -typemap /pro/lib/perl5/5.10.1/ExtUtils/typemap Pg.xs > Pg.xsc && mv Pg.xsc Pg.c cc -c -I/pro/pgsql-8.4.3/include -I/pro/lib/perl5/site_perl/5.10.1/IA64.ARCHREV_0-LP64/auto/DBI -Ae -DPERL_DONT_CREATE_GVSV +Z -z -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DD64 -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=80403 -DPGDEFPORT=5432 +O2 +Onolimit -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"2.17.1\" -DXS_VERSION=\"2.17.1\" +Z "-I/pro/lib/perl5/5.10.1/IA64.ARCHREV_0-LP64/CORE" Pg.c cc -c -I/pro/pgsql-8.4.3/include -I/pro/lib/perl5/site_perl/5.10.1/IA64.ARCHREV_0-LP64/auto/DBI -Ae -DPERL_DONT_CREATE_GVSV +Z -z -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DD64 -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=80403 -DPGDEFPORT=5432 +O2 +Onolimit -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"2.17.1\" -DXS_VERSION=\"2.17.1\" +Z "-I/pro/lib/perl5/5.10.1/IA64.ARCHREV_0-LP64/CORE" dbdimp.c "dbdimp.c", line 4472: warning #2068-D: integer conversion resulted in a change of sign if (!pg_db_end_txn(aTHX_ dbh, imp_dbh, -1==loid ? 0 : 1)) ^ cc -c -I/pro/pgsql-8.4.3/include -I/pro/lib/perl5/site_perl/5.10.1/IA64.ARCHREV_0-LP64/auto/DBI -Ae -DPERL_DONT_CREATE_GVSV +Z -z -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DD64 -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=80403 -DPGDEFPORT=5432 +O2 +Onolimit -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"2.17.1\" -DXS_VERSION=\"2.17.1\" +Z "-I/pro/lib/perl5/5.10.1/IA64.ARCHREV_0-LP64/CORE" quote.c "quote.c", line 334: warning #2513-D: a value of type "const char *" cannot be assigned to an entity of type "char *" result = string; ^ cc -c -I/pro/pgsql-8.4.3/include -I/pro/lib/perl5/site_perl/5.10.1/IA64.ARCHREV_0-LP64/auto/DBI -Ae -DPERL_DONT_CREATE_GVSV +Z -z -D_HPUX_SOURCE -Wl,+vnocompatwarnings +DD64 -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=80403 -DPGDEFPORT=5432 +O2 +Onolimit -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"2.17.1\" -DXS_VERSION=\"2.17.1\" +Z "-I/pro/lib/perl5/5.10.1/IA64.ARCHREV_0-LP64/CORE" types.c Running Mkbootstrap for DBD::Pg () chmod 644 Pg.bs rm -f blib/arch/auto/DBD/Pg/Pg.so But *linking* breaks, because the default -L flags from $LDFLAGS and $LDDLFLAGS are in front of $EXTRALIBS and/or $LDLOADLIBS and the linker now picks up the postgres-7 library :( :( EXTRALIBS = -L/pro/pgsql/lib -lpq LDLOADLIBS = -L/pro/pgsql/lib -lpq -lm BSLOADLIBS = LD_RUN_PATH = /pro/pgsql/lib LD_RUN_PATH="/pro/pgsq/lib" /usr/bin/ld -b +vnocompatwarnings -L/pro/local/lib -L/usr/lib/hpux64 Pg.o dbdimp.o quote.o types.o -o blib/arch/auto/DBD/Pg/Pg.so \ -L/pro/pgsql/lib -lpq -lm \ chmod 755 blib/arch/auto/DBD/Pg/Pg.so cp Pg.bs blib/arch/auto/DBD/Pg/Pg.bs chmod 644 blib/arch/auto/DBD/Pg/Pg.bs Manifying blib/man3/Bundle::DBD::Pg.3 Manifying blib/man3/DBD::Pg.3 After I changed my Makefile.PL and started over (see patch below), I get here: DBD-Pg-2.17.1 > make test PGINITDB="/pro/pgsql-8.4.3/bin/initdb" PERL_DL_NONLAZY=1 /pro/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/00-signature.t .... skipped: Set the environment variable TEST_SIGNATURE to enable this test t/00basic.t ......... ok t/01connect.t ....... 1/13 # # DBI Version 1.615 # DBD::Pg Version 2.17.1 # Perl Version 5.10.1 # OS hpux # PostgreSQL (compiled) 80403 # PostgreSQL (target) 80404 # PostgreSQL (reported) PostgreSQL 8.4.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839], 64-bit # Default port 5432 # DBI_DSN dbi:Pg: # DBI_USER postgres # Test schema dbd_pg_testschema # PGDATABASE fin0737 # PGHOST sv02 # array_nulls on # backslash_quote safe_encoding # client_encoding UTF8 # server_encoding UTF8 # standard_conforming_strings off t/01connect.t ....... ok t/01constants.t ..... ok t/02attribs.t ....... 84/249 # Failed test 'Failed ping returns a SQLSTATE code of 08000' # at t/02attribs.t line 1597. # got: '22000' # expected: '08000' t/02attribs.t ....... 247/249 # Looks like you failed 1 test of 249. t/02attribs.t ....... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/249 subtests (less 1 skipped subtest: 247 okay) t/03dbmethod.t ...... ok t/03smethod.t ....... ok t/04misc.t .......... ok t/06bytea.t ......... ok t/07copy.t .......... ok t/08async.t ......... ok t/09arrays.t ........ ok t/12placeholders.t .. ok t/20savepoints.t .... ok t/99cleanup.t ....... 1/1 Removing test database directory t/99cleanup.t ....... ok Test Summary Report ------------------- t/02attribs.t (Wstat: 256 Tests: 249 Failed: 1) Failed test: 244 Non-zero exit status: 1 Files=15, Tests=1707, 20 wallclock secs ( 0.53 usr 0.10 sys + 3.63 cusr 0.71 csys = 4.97 CPU) Result: FAIL Failed 1/15 test programs. 1/1707 subtests failed. make: *** [test_dynamic] Error 255 Good enough for now. And here's the patch. FWIW HP-UX 9 is so archaic that even /I/ do not have access to it anymore :) --8<--- --- Makefile.PL.org 2010-04-07 22:52:55 +0200 +++ Makefile.PL 2010-10-15 16:35:35 +0200 @@ -211,19 +211,16 @@ my %opts = PERL_MALLOC_OK => 1, NEEDS_LINKING => 1, NO_META => 1, - NORECURS => 1, + NORECURS => 1, clean => { FILES => 'trace Pg.xsi README.testdatabase' }, - realclean => { FILES => 'dbdpg_test_database/' }, + realclean => { FILES => 'dbdpg_test_database/' }, + macro => { + LDFLAGS => "-L$POSTGRES_LIB $Config{ldflags}", + LDDLFLAGS => "-L$POSTGRES_LIB $Config{lddlflags}", + }, ); -if ($os eq 'hpux') { - my $osvers = $Config{osvers}; - if ($osvers < 10) { - print "Warning: Forced to build static not dynamic on $os $osvers.\a\n"; - $opts{LINKTYPE} = 'static'; - } -} -elsif ($os =~ /Win32/) { +if ($os =~ /Win32/) { my $msdir = $POSTGRES_LIB; $msdir =~ s{"$}{/ms"}; $opts{LIBS}[0] .= " -L$msdir -lsecur32"; -->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/
--- Makefile.PL.org 2010-04-07 22:52:55 +0200 +++ Makefile.PL 2010-10-15 16:35:35 +0200 @@ -211,19 +211,16 @@ my %opts = PERL_MALLOC_OK => 1, NEEDS_LINKING => 1, NO_META => 1, - NORECURS => 1, + NORECURS => 1, clean => { FILES => 'trace Pg.xsi README.testdatabase' }, - realclean => { FILES => 'dbdpg_test_database/' }, + realclean => { FILES => 'dbdpg_test_database/' }, + macro => { + LDFLAGS => "-L$POSTGRES_LIB $Config{ldflags}", + LDDLFLAGS => "-L$POSTGRES_LIB $Config{lddlflags}", + }, ); -if ($os eq 'hpux') { - my $osvers = $Config{osvers}; - if ($osvers < 10) { - print "Warning: Forced to build static not dynamic on $os $osvers.\a\n"; - $opts{LINKTYPE} = 'static'; - } -} -elsif ($os =~ /Win32/) { +if ($os =~ /Win32/) { my $msdir = $POSTGRES_LIB; $msdir =~ s{"$}{/ms"}; $opts{LIBS}[0] .= " -L$msdir -lsecur32";