Thread

  1. Re: HP-UX shared library installation is incorrect

    Giles Lean <giles@nemeton.com.au> — 2002-12-23T06:02:53Z

    I wrote:
    
    > My recommendation (with a pinch of salt, since I'm still not a HP-UX
    > toolchain guru) is to add
    > 
    >     +h lib$(NAME)$(DLSUFFIX).$SO_MAJOR_VERSION)
    > 
    > to the HP-UX LINK.shared line in src/Makefile.shlib, and to change the
    > way the symlinks run as well, so that libpq.sl is a link to the latest
    > version of libpq that is installed.
    
    OK, I've done this.  A patch is below, against 7.3.1 source.  I've
    sent it here instead of to the -patches list, since:
    
    o here is where the discussion was
    
    o so far I've only tested with the HP ANSI C compiler on 11.11, not
      with gcc or on other HP-UX releases.
    
      I can test other releases and probably with gcc, but if someone gets
      to it before me that would be just fine.  I probably won't until the
      new year.
    
    Checking the 32 bit install:
    
    $ ls -l libpq*
    -rw-r--r--   1 root  users  158556 Dec 22 21:22 libpq.a
    lrwxr-xr-x   1 root  users      10 Dec 22 21:22 libpq.sl@ -> libpq.sl.3
    -r-xr-xr-x   1 root  users  143360 Dec 22 21:22 libpq.sl.3*
    
    $ /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
    
    There's still that "../../../src/.." in the output, but the library
    has been found correctly with the version number, which is what is
    most important.
    
    I ran configure with a --prefix=/opt/pgsql-7.3.1 argument, but most
    clients will link against /opt/pgsql/lib so their paths won't have the
    version number.
    
    The 64 bit libraries are similar:
    
    $ ls -l libpq*
    -rw-r--r--   1 root  users  219202 Dec 22 21:38 libpq.a
    lrwxr-xr-x   1 root  users      10 Dec 22 21:38 libpq.sl@ -> libpq.sl.3
    -r-xr-xr-x   1 root  users  131024 Dec 22 21:38 libpq.sl.3*
    
    $ /usr/ccs/bin/ldd psql
            libpq.sl.3 =>   /opt/pgsql-7.3.1/lib/pa20_64/libpq.sl.3
            libc.2 =>       /lib/pa20_64/libc.2
            libxcurses.1 => /lib/pa20_64/libxcurses.1
            libgen.2 =>     /lib/pa20_64/libgen.2
            libdl.1 =>      /lib/pa20_64/libdl.1
            libnsl.1 =>     /lib/pa20_64/libnsl.1
            libm.2 =>       /lib/pa20_64/libm.2
            libnsl.1 =>     /lib/pa20_64/libnsl.1
            libdl.1 =>      /usr/lib/pa20_64/libdl.1
            libdl.1 =>      /usr/lib/pa20_64/libdl.1
            libxti.2 =>     /usr/lib/pa20_64/libxti.2
    
    Again, the 64 bit binaries have linked to the versioned library. As
    a bonus the ldd output looks better too. :-)
    
    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)