[Insight-users] Recent regression: can't wrap non-apple Python on Darwin/OS X

Brad King brad.king at kitware.com
Mon, 16 Feb 2004 16:29:22 -0500


Zachary Pincus wrote:
> Hello,
> 
> With ITK 1.6 on Darwin, it was possible to create (sort of working) 
> python wrappers for versions of Python not supplied by Apple. It is no 
> longer possible to do so with the current CVS version of ITK.
> 
> That is, in the ccmake configuration, set PYTHON_LIBRARY to 
> /sw/lib/config/libpython23.dylib (or whatever external libpython you 
> have) instead of "-framework Python", and then set the corresponding 
> headers and python executable path. Anyhow, in ITK 1.6, this resulted in 
> moderate success.
> 
> However, with the CVS version of ITK (updated yesterday), these same 
> configuration steps lead to the following python error:
> %> # run the InsightToolkit import routine
> %> /sw/bin/python InsightToolkit.py
> Fatal Python error: Interpreter not initialized (version mismatch?)
> Abort
> 
> This error usually appears when a python extension module is loaded by a 
> version of python which the module is not linked against. However, I 
> explicitly set that python (and it's associated libpython) as the link 
> target in ccmake (above). Moreover, for all of the obvious 
> python-related libraries (i.e. bin/_*), otool -L (darwin's equivalent of 
> ldd) shows the link target as the proper external python I specified.
> 
> So, somewhere in the bowels of some library, it appears that the python 
> library link target is getting incorrectly specified. Moreover, this 
> problem seems to be new in the CVS.

How big is _ITKBasicFiltersPython.so?  I think this library has grown so 
large that the Mac cannot handle it anymore as a dynamically loaded 
library.  We are currently making some major changes to help get Java 
support working, so when those are done we can split the library into 
multiple smaller libraries to work-around this problem.

-Brad