[CMake] cmake-2.8.4 on HP-UX runpath issues

Peter O'Gorman cmake at mlists.thewrittenword.com
Sat May 7 09:09:52 EDT 2011


We're running into problems with cmake on hp-ux, if we had used 2.6.x we
would have seen the problems there too.

Building e.g. libproxy on hppa*-hp-hpux11.31 32 bit, in its own prefix
/opt/TWWfsw/libproxy04 chatr shows us after install:

         shared library 
         shared library dynamic path search:
             SHLIB_PATH     disabled  second 
             embedded path  enabled   first  /opt/TWWfsw/libproxy04/lib:/usr/lib
         internal name:
         shared library list:
             static    /opt/build/libproxy-0.4.6/libproxy/../libmodman/libmodman.sl.1
             dynamic   /usr/lib/libnsl.1
             dynamic   /usr/lib/libcma.2

As you can see the path to the build dir's libmodman.sl is encoded in
the installed libproxy, worse, it's "static" so even if SHLIB_PATH were
enabled, it will not override the static entry. Removing the builddir
makes any application using libproxy abort() at start because the static
entry for libmodman can not be found.

It is listed as "static" because cmake always uses a
path/to/libmodman.sl when invoking the linker. So we hacked our
cmake-2.8.4 to always use -L.. -l on hpux, this helps a little, the
library is now listed as "dynamic" and because of that SHLIB_PATH and
the embedded path can also be used. However, the full path to the build
dir remains encoded in the output. We'd like to fix that, turn our hack
into a usable patch and have it applied.

What we need to do to accomplish that:
When relinking, currently cmake relinks libraries and executables prior
to installing them. This accomplishes nothing on HP-UX, to change the
path, the libraries must be found in the install directory.
How can we change so that relinking happens after install, and replaces
the installed shared libraries and executables? I have no idea which
source files to even begin looking in.

Alternatively the HP-UX 11 linker has a +cdp option that allows
replacing of build paths with install paths, to use this, instead of
giving ./path/to/libfoo.sl on the link line, cmake would have to add
-L./path/to -lfoo -Wl,+cdp,./path/to:/install/prefix/lib. This solution
would only work for HP-UX 11 though, and we still support customers on
HP-UX 10.20. We'd prefer to have relinking after install.

Thanks for your help,
Peter O'Gorman
pogma at thewrittenword.com

More information about the CMake mailing list