[CMake] RPATH questions

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Jul 24 16:22:41 EDT 2006


On 2006-07-24 11:14-0400 Brad King wrote:

> If you don't set BUILD_WITH_INSTALL_RPATH or SKIP_BUILD_RPATH properties
> then the modules built into the build tree will have the proper rpath to
> load from there.

Thanks for that useful information which I have just confirmed.  I have also
just confirmed that the rpath properties propagate in the build tree without
any special intervention.  What I mean by that is I have two target
libraries: libplplotcxxd which depends on libplplotd but which has no
direct dependend on libltdl, and libplplotd which
depends on libltdl in a special location.  Here are the ldd results:

ldd bindings/c++/libplplotcxxd.so
         libplplotd.so.9 => /home/software/plplot_cvs/HEAD/build_dir/src/libplplotd.so.9 (0xb7fa2000)
         libltdl.so.3 => /home/software/autotools/install/lib/libltdl.so.3 (0xb7f9b000)
 	...

ldd src/libplplotd.so
         libm.so.6 => /lib/tls/libm.so.6 (0xb7f7b000)
 	libltdl.so.3 => /home/software/autotools/install/lib/libltdl.so.3 (0xb7f73000)
 	...

So all is well in the build tree, but see below for the bad install tree
results.

> Then just set the INSTALL_RPATH property to the
> desired rpath for the installed version.  When you run "make install" a
> separate copy will be linked and installed with the modified rpath.
>
> Summary:  Just set INSTALL_RPATH on the module target to be the rpath
> needed in the install tree.  Then things will just work.

I followed that advice for INSTALL_RPATH with libplplotd, and it worked, but
unlike the build tree case it did not automatically propagate to
libplplotcxxd.  Here are the ldd results for the install location:

ldd ~/plplot_cvs/installcmake/lib/libplplotd.so
         libm.so.6 => /lib/tls/libm.so.6 (0xb7f7b000)
 	libltdl.so.3 => /home/software/autotools/install/lib/libltdl.so.3 (0xb7f73000)
 	...

ldd ~/plplot_cvs/installcmake/lib/libplplotcxxd.so
         libplplotd.so.9 => /home/software/plplot_cvs/installcmake/lib/libplplotd.so.9 (0xb7fa3000)
         libltdl.so.3 => /usr/lib/libltdl.so.3 (0xb7f87000)

Note, the last one is the system libltdl.so location which is out of date
and which I therefore want to consistently avoid.

Note, libplplotcxxd has no direct dependencies on libltdl so the only reason
why it even knows about libltdl is through its dependency on the libplplotd
target.  So why doesn't it automatically pick up the correct INSTALL_RPATH
information from that target?  Is this a bug in CMake-2.4.2?

Of course, I can presumably work around this CMake-2.4.2 limitation by
supplying INSTALL_RPATH information to every target in my project which
depends on the libplplot target, but there are a lot of targets in my
project and virtually all of them depend on the libplplot core library so
this is quite a messy workaround.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list