[Insight-developers] Installed ITK with shared libraries

Zachary Pincus zpincus at stanford.edu
Thu Feb 23 20:40:56 EST 2006


Hi folks,

Does anyone know if there are any plans for how ITK will support the  
use of shared libraries from ITK installations?

You may have seen the discussion of this on the itk-user or cmake  
lists, so here is just a brief summary:

ITK, if built with shared libraries and installed, is not usable on  
OS X.  I strongly suspect this is true on most other unix platforms,  
and possibly windows too.

This is because the rpath information for where the dynamic loader is  
to find the shared libraries is set to the build directory. So if you  
link against an installed copy of an ITK library, at runtime the  
loader will look for the library in the *build directory*. This  
directory may not exist any more (or for e.g. an RPM, it may have  
never existed on that machine).

In many cases (certainly on OS X), setting PATH or [DY] 
LD_LIBRARY_PATH is insufficient because those values will not be  
consulted when the library has an absolute rpath.

This problem can be solved in several ways. One is to create two  
different versions of each shared library: one with an rpath pointing  
to the build location, one pointing to the install location. Only the  
latter is installed. Brad King informs me for some Lunux  
distributions, using rpaths at all is of frowned upon.

The other option is to not have rpaths at all. Then the ITK libraries  
would need to be installed into a standard location where the loader  
knows to look, or users would have to set [DY]LD_LIBRARY_PATH (unix)  
or PATH (win) to include the installation directory.

Are there any thoughts as to how this issue ought to be handled in ITK?

Zach


More information about the Insight-developers mailing list