[Insight-users] ITK 2.0.1 on OS X compile problem -- Solution

Zachary Pincus zpincus at stanford.edu
Mon Jul 11 23:56:09 EDT 2005


Hello,

For a while I've been seeing issues on the ITK list about a compile  
problem with ITK 2.0.1 on OS X. I've just realized that though this  
issue was resolved in the ITK CVS tree, people who have had this  
problem may not be aware of this development, because it wasn't made  
clear to everyone who had the issue.

Anyhow, if you (or anyone you know) has been having linker errors  
compiling ITK 2.0.1 on OS X of the following sort:
> Building shared library /Users/mschabel/Code/C++/ITK/  
> InsightToolkit-2.0.1/bin/libitkvnl.dylib...
> ld: vnl_math.o illegal reference for -dynamic code (section   
> difference reference from section (__TEXT,__eh_frame) relocation   
> entry (0) to symbol: ___isnan defined in dylib: /usr/lib/libm.dylib)
> /usr/bin/libtool: internal link edit command failed
> make[9]: *** [/Users/mschabel/Code/C++/ITK/InsightToolkit-2.0.1/ 
> bin/ libitkvnl.dylib] Error 1

The solution is to either
(a) checkout a recent CVS copy of ITK (directions are on the ITK  
download page), or
(b) Edit the file:
[INSIGHT_ROOT]/Utilities/vxl/core/vnl/vnl_math.cxx
changing line 62 from:
# define isnan __isnan
to
# define isnan(x) __isnand((double)x)

This simple fix will allow ITK 2.0.1 to compile on OS X.

Sorry to those CC'd if this is the first help you've gotten on this  
vexing issue!

Zach Pincus

Program in Biomedical Informatics and Department of Biochemistry
Stanford University School of Medicine



More information about the Insight-users mailing list