[Insight-developers] Problems compiling ITK on OSX
Kathryn Hayes
hayes at bwh.harvard.edu
Wed Jun 8 10:50:25 EDT 2005
Hi,
I sent this email to insight-users last week, but haven't heard back. I
also wanted to add that we hit this problem in Slicer a while ago in some
of our modules using isnan. The work-around was to add the following:
// isnan() is broken in /usr/include/gcc/darwin/3.3/c++/cmath
#if defined(__APPLE__) && defined(__MACH__)
extern "C" int isnan (double);
#endif
Here is the original text of my email:
We took a security patch on our Mac OSX 10.3 machine last night, and we're
now having problems compiling ITK (ITK-Slicer-2-5). I found a couple of
other references to this problem in the archives (e.g.
http://public.kitware.com/pipermail/insight-users/2005-May/013042.html),
but no solution.
The error is:
Building shared library /Users/hayes/dev-cvs-nightly/slicer2/Lib/darwin-ppc/Insight-build/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/hayes/dev-cvs-nightly/slicer2/Lib/darwin-ppc/Insight-build/bin/libitkvnl.dylib] Error 1
I believe that this may be related to a known issue in
/usr/include/gcc/darwin/3.3/c++/cmath that #undefs isnan().
Here is a small example of the behavior:
-----------------------------------
#include <cmath>
int main(int argc, char **argv) {
int x = isnan(10.0);
}
-----------------------------------
Result:
mimer:/tmp hayes$ c++ zz.cxx -o zz.o -lm
zz.cxx: In function `int main(int, char**)':
zz.cxx:4: error: `isnan' undeclared (first use this function)
zz.cxx:4: error: (Each undeclared identifier is reported only once for
each function it appears in.)
-----------------------------------
#include <cmath>
int main(int argc, char **argv) {
int x = __isnan(10.0);
}
-----------------------------------
Result:
mimer:/tmp hayes$ c++ zz.cxx -o zz.o -lm
ld: /var/tmp//ccmT5loo.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)
Both __isnand and __isnanf do work, however. Any ideas?
Katie
More information about the Insight-developers
mailing list