Fix for HP-UX shared library builds

From: Giles Lean <giles(at)nemeton(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: Fix for HP-UX shared library builds
Date: 2002-12-23 22:37:58
Message-ID: 4171.1040683078@hpchs.cup.hp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

[ Take #3: send the mail *with* the patch (problem #1), send
if *from* an address that is subscribed to the list (problem #2).
It's time for me to shut my brain down for Christmas. --giles ]

Hi,

Below is a patch against 7.3.1 that makes shared library major numbers
useful on HP-UX.

Without this patch PostgreSQL builds on HP-UX install libraries
without internal names, with the result that applications link to
'libpq.sl' without a version number.

With the patch below the following changes are made:

1. libraries have an internal name set with ld +h

2. a symbolic link is created from the non-version name to the
version name, that is (on a patched 7.3.1 install):

$ ls -l libpq*
-rw-r--r-- 1 root sys 164330 Dec 24 08:43 libpq.a
lrwxrwxrwx 1 root sys 10 Dec 24 08:43 libpq.sl -> libpq.sl.3
-r-xr-xr-x 1 root sys 159744 Dec 24 08:43 libpq.sl.3

instead of (on an unpatched 7.2.3 install):

$ ls -l libpq*
-rw-r--r-- 1 root users 103544 Oct 6 14:54 libpq.a
-r-xr-xr-x 1 root users 102400 Oct 6 14:54 libpq.sl
lrwxr-xr-x 1 root users 8 Oct 6 14:54 libpq.sl.2 -> libpq.sl

3. applications link to the versioned library

$ /usr/ccs/bin/ldd psql
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libnsl.1 => /usr/lib/libnsl.1
/usr/lib/libxti.2 => /usr/lib/libxti.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libgen.2 => /usr/lib/libgen.2
/usr/lib/libc.2 => /usr/lib/libc.2
../../../src/interfaces/libpq/libpq.sl.3 => /opt/pgsql-7.3.1/lib/libpq.sl.3
/usr/lib/libnsl.1 => /usr/lib/libnsl.1

instead of:

$ /usr/ccs/bin/ldd psql
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libnsl.1 => /usr/lib/libnsl.1
/usr/lib/libxti.2 => /usr/lib/libxti.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libgen.2 => /usr/lib/libgen.2
/usr/lib/libc.2 => /usr/lib/libc.2
../../../src/interfaces/libpq/libpq.sl => /opt/pgsql-7.2.3/lib/libpq.sl
/usr/lib/libnsl.1 => /usr/lib/libnsl.1

I have tested this patch on:

HP-UX 11.11, HP ANSI C compiler, 64 bit and 32 bit builds
HP-UX 11.11, gcc, 32 bit build
HP-UX 11.00, HP ANSI C compiler, 32 bit build
HP-UX 10.20, HP ANSI C compiler

'gmake check' passed in all cases, and the installed library paths
were correct. Having checked 10.20, 11.00, 11.11 and both gcc and the
HP ANSI C compiler I think this patch is safe to commit, and I request
that it be applied both to the HEAD and the 7.3.x branch.

Regards,

Giles

*** src/Makefile.shlib-orig Wed Oct 9 09:21:54 2002
--- src/Makefile.shlib Sun Dec 22 21:07:43 2002
***************
*** 126,134 ****
endif

ifeq ($(PORTNAME), hpux)
! # HPUX doesn't believe in version numbers for shlibs
! shlib := lib$(NAME)$(DLSUFFIX)
! LINK.shared = $(LD) -b +b $(libdir)
endif

ifeq ($(PORTNAME), irix5)
--- 126,133 ----
endif

ifeq ($(PORTNAME), hpux)
! shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
! LINK.shared = $(LD) +h $(shlib) -b +b $(libdir)
endif

ifeq ($(PORTNAME), irix5)

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2002-12-26 01:44:30 MOVE strangeness
Previous Message Giles Lean 2002-12-23 22:21:54 Fix for HP-UX shared library builds