[vtkusers] Link error building VTK 4.4 on Mac OS 10.4 with gcc 4.0 (but not 3.3)

Martin Costabel costabel at wanadoo.fr
Thu Jun 9 03:13:31 EDT 2005


Sean McBride wrote:
> Hello again!
> 
> I'm using cmake 2.0.6, vtk 4.4, Mac OS 10.4.1, and XCode 2.1.  If I use
> gcc 3.3 vtk seems to build just fine, great!  But with gcc 4.0 (which I
> want to use) it dies part way through, with the following:
> 
> ...
> Building object file RGrid.o...
> Building executable /Users/sean/Desktop/vtk/vtk/VTK_gcc4_plain/bin/
> GraphicsCxxTests...
> /usr/bin/ld: Undefined symbols:
> __ZNSt8ios_base4InitC4Ev
> collect2: ld returned 1 exit status

Looking at the sources, you can find the following gem in 
Graphics/vtkAppendFilter.cxx and about 2 dozen other source files:

//-----  This hack needed to compile using gcc3 on OSX until new 
stdc++.dylib
#ifdef __APPLE_CC__
extern "C"
{
   void oft_initGraphics()
   {
   extern void _ZNSt8ios_base4InitC4Ev();
   _ZNSt8ios_base4InitC4Ev();
   }
}
#endif

This symbol is gcc-3.3 speak for std::ios_base::Init::Init[unified](), 
absent from gcc-4.0 (which can't even demangle it). So I guess the hack 
can go now, or at least it should check whether __GNUC__ is 3.

-- 
Martin






More information about the vtkusers mailing list