Fix for HP-UX shared library builds - Mailing list pgsql-patches

From Giles Lean
Subject Fix for HP-UX shared library builds
Date
Msg-id 4018.1040682114@hpchs.cup.hp.com
Whole thread Raw
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: disabled, deferred triggers
Next
From: Giles Lean
Date:
Subject: Fix for HP-UX shared library builds