From: Brad K. <bra...@ki...> - 2005-06-08 15:28:07
|
Hello, Several users of both VXL and ITK (with its internal vnl) have encountered the following error on Tiger OSX: 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 I found the reason and a fix, all discussed here: http://public.kitware.com/pipermail/insight-users/2005-May/013259.html http://public.kitware.com/pipermail/insight-users/2005-May/013261.html http://public.kitware.com/pipermail/insight-users/2005-May/013270.html http://public.kitware.com/pipermail/insight-users/2005-May/013278.html The problem is in vnl/vnl_math.cxx which 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 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 I'd like to commit this change to vnl_math.cxx but I'm checking with this list first in case there are any comments or suggestions. -Brad |