[Insight-users] ITK will not build with shared libs enabled on the Mac (G5)

Brad King brad.king at kitware.com
Mon Sep 13 16:41:46 EDT 2004


Jon H Kaspersen wrote:
> I did a clean standard build of ITK,
> then I used ccmake to enable shared libs - which brakes the build with
> the following error:
> 
> c++ -dynamiclib    -o /Users/jonk/cvs/ITKbin/bin/libitkvnl_algo.dylib 
[snip]
> ld: Undefined symbols:
> std::basic_ostream<char, std::char_traits<char> >& operator<< 
> <double>(std::basic_ostream<char, std::char_traits<char> >&, 
> vnl_matrix<double> const&)

I finally had a few minutes to look at this problem.  This looks like a 
problem with the latest OSX build tools.  Consider the following example 
code:

   template <class T> void foo(T) {}
   template <class T> void bar(T t) { foo(t); }
   template void bar<int>(int);
   template void foo<int>(int);

On an older OSX installation this builds and produces these symbols:

   00000000 T __Z3barIiEvT_
   00000034 T __Z3fooIiEvT_

On a newer OSX installation these symbols are produced instead:

   00000000 T __Z3barIiEvT_
   00000054 S __Z3fooIiEvT_

This is causing vnl's explicit instantiations to break.

Jon, can you report this to the Mac developers as you did the previous 
problems with explicit instantiation?

Thanks,
-Brad


More information about the Insight-users mailing list