[Insight-users] InsightToolkit update to 3.12.0 in MacPorts, with wrapping for tcl8.5 and python2.5

Darren Weber darren.weber.lists at gmail.com
Fri May 29 18:59:02 EDT 2009


The MacPorts port for InsightToolkit (ITK) is now updated to ITK 3.12.0 (it
should be easy to update it for the 3.14.0 release soon).  In testing, the
wrapping works for tcl8.5 and python2.5 (maybe Apple java too - please
confirm).  To get functional wrapping, use only revision 3 of this port.

For reference:
http://www.macports.org/
https://trac.macports.org/wiki/InstallingMacPorts

This is the Portfile, which may take a few days to migrate into the general
release from the trunk:
https://svn.macosforge.org/repository/macports/trunk/dports/graphics/InsightToolkit/Portfile

Advice and comments on the port are welcome, especially if there are
additional features that could be enabled.  Please consider the port
functional, but also a work in progress.  At this time, the port does not
include the InsightApplications (one step at a time; that may be a separate
port).  To install the port, run the following (probably _overnight_ a this
is a very lengthy build and install process):

sudo port install InsightToolkit

It's a very long build and install process (in testing, there was some
random instability with parallel builds, so that was disabled to provide a
reliable build and install).  For detailed progress on the build and
install, use:

sudo port -d install InsightToolkit

The -d option is used for 'debug' information, but also serves as a useful
progress meter for this very long build and installation process - several
hours even on a fast system.

The default variants select the documentation, shared libs, and wrappers for
tcl, java, and python2.5.  You can see the install paths for the
documentation etc. by using:

port variants InsightToolkit

To get a full listing of all the files provided, run this after
installation:

port contents InsightToolkit

Once it's installed, your CMakeLists.txt file(s) may have to set the ITK_DIR
to be certain about linking, i.e.:
SET (ITK_DIR /opt/local/lib/InsightToolkit-3.12)

If this port has succeeded in the right modifications to FindITK.cmake etc
(see PS below), then it is possible to use this too to get a version
specific link:
FIND_PACKAGE(ITK-3.12 REQUIRED)

Once macports gets a revision to cmake (hopefully soon), the
FIND_PACKAGE(ITK REQUIRED) should find and link against a generic
/opt/local/lib/InsightToolkit installation, rather than a version specific
installation (i.e., the FindITK.cmake module should find a MacPorts
installation before it finds any others on the system).

Take care,
Darren


PS

One issue with the port is the non-default installation location to
/opt/local/lib/InsightToolkit-3.12/.  I made the decision to provide this
version specific library path (and /opt/local/include/InsightToolkit-3.12/),
so it may be possible to install multiple versions of the library in
MacPorts (there may be some bugs to work out for this).  The InsightToolkit
specifies very tight compatibility versions (e.g., itk 3.12.0 has
compatibility only for 3.12.0), so any MacPorts software that builds on it
may either require a specific version dependency or it will have to keep up
with the current version available in MacPorts.  In case any software that
is stable for a specific version is included in MacPorts, it should be
possible to get a resolution for a version specific dependency.  When this
port is updated to 3.14.0, the current port will move to a new port name,
called InsightToolkit312, so it will remain available at that version.

However, this raised a port issue because the cmake macro FindITK.cmake is
managed by the cmake port (under
/opt/local/share/cmake-2.6/Modules/FindITK.cmake).  Rather than hack that
file directly (which should happen in a new revision for cmake @ 2.6.4),
this port does several things.  First it creates a symlink from
PREFIX/lib/InsightToolkit to PREFIX/lib/InsightToolkit-3.12 (where PREFIX is
/opt/local).  It also makes a copy of FindITK.cmake into FindITK-3.12.cmake
and modifies the content of the copy to indicate the include and lib paths
are PREFIX/lib/InsightToolkit-3.12/ (a revision to the cmake port should do
similarly for FindITK.cmake).  Furthermore, the
PREFIX/lib/InsightToolkit-3.12/ITKConfig.cmake was modified to point to this
install path also.  I guess it is a bug in cmake that the
CMAKE_INSTALL_NAME_DIR:STRING=${prefix}/lib/InsightToolkit-3.12 is not
actually used as the install path (it defaults back to
${prefix}/lib/InsightToolkit), or I'm missing another cmake variable setting
to control this.

Some port hacks were required to get all the rpath settings right for the
Tcl .dylib and python .so libraries in the WrapITK/lib/.   Further hacks
were required for the itkwish shell script in $prefix/bin/itkwish and the
actual binary in WrapITK/bin/itkwish.  On my system, at least, the itkwish
binary works and the 'import itk' works for python2.5.  The wrapper also
includes java, but I've not tested it.  The port does try to fix library
references in the .jnilib files, but this assumes those files can be
modified by install_name_tool (actually, I have no idea how to work with
.jnilib files, so please enlighten me if you want java wrapping to work, if
it's not working already).

It might be possible to get the wrapping working for python2.6, but I
encountered some weird results when trying to set the configuration options
for the python2.6 framework library in MacPorts.  Despite setting specific
paths to the python2.6 library in macports, the cmake or WrapITK
configuration process automatically redefined the library variables to
'-framework Python' and that was automatically resolved to the Apple
framework in /Library/... rather than the MacPorts framework in
/opt/local/Library/...  It may be possible to resolve this using some
environment variable settings, but it would be nice to avoid that, if
possible, in preference to specific cmake (or WrapITK) configuration
settings.


PPS

For the curious, the details of the port are all in the pseudo tcl script
called the 'Portfile', see:
https://svn.macosforge.org/repository/macports/trunk/dports/graphics/InsightToolkit/Portfile
<https://svn.macosforge.org/repository/macports/users/dweber/graphics/InsightToolkit/Portfile>
A proposed revision for the MacPorts cmake port is at:
https://svn.macosforge.org/repository/macports/users/dweber/devel/cmake/Portfile

If you want to use these Portfiles directly, you can follow the guide
instructions at:
http://guide.macports.org/#development.local-repositories
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090529/7ad41d97/attachment.htm>


More information about the Insight-users mailing list