[Insight-developers] Re: [Insight-users] Tiger OSX

Brad King brad.king at kitware.com
Mon May 23 15:15:38 EDT 2005


Zachary Pincus wrote:
> It seems that there have been some isolated and difficult-to-reproduce  
> troubles with compiling ITK, on OS X 10.3.x and 10.4, which keep  
> cropping up on the insight-users list.
> 
> These troubles seem to center around isnan() being either undefined at  
> compile time or at link time.
[snip]
> Does anyone who knows more about VCL than I have any comments?

I have not investigated this issue but I know someone who recently had 
problems building VXL on OSX that asked me to look at isnan problems. 
The following is from memory and might help...

I think the problem is in vnl/vnl_math.cxx which bypasses VCL to solve 
this problem.  It directly includes <math.h> and then has these lines:

#if defined(__APPLE__)
# include <math.h>
# define isnan __isnan
#endif

The problem is that __isnan gets 2 definitions in C++ on Tiger OSX.  One 
of them is inline and the other has external linkage.  When it gets 
compiled into a static library the inline version of the symbol is not 
built as relocatable code, but there is a relocation entry for the 
symbol in the shared version provided by the system library.

The "quick" solution is to avoid use of the inline version of the symbol 
by using these lines instead:

#if defined(__APPLE__)
# include <math.h>
# define isnan(x) __isnand((double)x)
#endif

The "real" solution is to fix VCL as you suggest and then use it from 
vnl_math.cxx.

-Brad


More information about the Insight-developers mailing list