[vtkusers] Can't compile VTK 4.4 on Mac OS X: vtkOpenGLRenderWindow.h:104: parse error before `)'

Gordon Kindlmann gk at cs.utah.edu
Sat Jan 17 19:08:20 EST 2004


hi,

>> Building object file vtkGraphicsFactory.o...
>> c++ -o vtkGraphicsFactory.o    -Wno-deprecated -no-cpp-precomp 
>> -I/usr/X11R6/include -I/Users/gk/vtk/VTK/Rendering 
>> -I/Users/gk/vtk/VTK -I/Users/gk/vtk/VTK/Patented 
>> -I/Users/gk/vtk/VTK/Rendering -I/Users/gk/vtk/VTK/IO 
>> -I/Users/gk/vtk/VTK/Imaging -I/Users/gk/vtk/VTK/Graphics 
>> -I/Users/gk/vtk/VTK/Filtering -I/Users/gk/vtk/VTK/Common 
>> -I/Users/gk/vtk/VTK/Common/Testing/Cxx 
>> -I/Users/gk/vtk/VTK/Utilities/zlib -I/Users/gk/vtk/VTK/Utilities/jpeg 
>> -I/Users/gk/vtk/VTK/Utilities/png -I/Users/gk/vtk/VTK/Utilities/tiff 
>> -I/Users/gk/vtk/VTK/Utilities/expat 
>> -I/Users/gk/vtk/VTK/Utilities/DICOMParser 
>> -I/Users/gk/vtk/VTK/Utilities/freetype/include 
>> -I/Users/gk/vtk/VTK/Utilities/freetype 
>> -I/Users/gk/vtk/VTK/Utilities/ftgl/src 
>> -I/Users/gk/vtk/VTK/Utilities/ftgl 
>> -I/Users/gk/vtk/VTK/Rendering/tkInternals/tk84OSX 
>> -I/usr/X11R6/include 
>> -I/Library/Frameworks/Tcl.framework/Versions/8.4/Headers 
>> -I/Library/Frameworks/Tk.framework/Versions/8.4/Headers   
>> -I/usr/X11R6/include  -c 
>> /Users/gk/vtk/VTK/Rendering/vtkGraphicsFactory.cxx
>> In file included from 
>> /Users/gk/vtk/VTK/Rendering/vtkXOpenGLRenderWindow.h:25,
>>                  from 
>> /Users/gk/vtk/VTK/Rendering/vtkGraphicsFactory.cxx:61:
>> /Users/gk/vtk/VTK/Rendering/vtkOpenGLRenderWindow.h:30:40: GL/gl.h: 
>> No such file or directory
>
> This looks like you may not have the X11 headers installed. The 
> compiler cannot find gl.h, and it should be in 
> /usr/X11R6/include/GL/gl.h. Can you check in /usr/X11R6/include to 
> make sure that it's there?

No, it wasn't there.  Thanks for pointing this out.

Doesn't it seem odd that CMake knew enough to complain that 
OPENGL_INCLUDE_DIR wasn't set correctly, but didn't know enough to see 
if the value I gave it was useless, because the file it needed wasn't 
there?

>  There is a separate installer to install the X11 SDK and Headers. 
> You'll need to make sure that both X11 and the X11 SDK are installed. 
> You said that you're running 10.2.6, so I'm not sure if you can still 
> download Apple's X11 beta.

Apple doesn't make them available anymore, but I found something that 
seemed to work at:
<http://vuiis.vanderbilt.edu/~martinbw/Download/MacOSX>
The X11SDKForMacOSX.dmg file created the GL header files in 
/usr/X11R6/include/GL.

Then, when I tried again to compile, eventually I got:
Building executable /Users/gk/vtk/VTK/bin/vtk...
c++        -Wno-deprecated -no-cpp-precomp -I/usr/X11R6/include -fPIC  
vtkTkAppInit.o    -o /Users/gk/vtk/VTK/bin/vtk  -L. 
-L/Users/gk/vtk/VTK/bin -L/usr/X11R6/lib -lvtkCommonTCL 
-lvtkFilteringTCL -lvtkGraphicsTCL -lvtkImagingTCL -lvtkIOTCL 
-lvtkRenderingTCL -lvtkPatentedTCL -lvtkRendering -lvtkftgl 
-lvtkfreetype -framework AGL -framework OpenGL -lSM -lICE -lSM -lICE 
-lX11 -lXext -lX11 -lXext -lXt -lSM -lICE -lX11 -lXext -framework Tk 
-lvtkPatented -lvtkIOTCL -lvtkIO -lvtkDICOMParser -lvtkpng -lvtktiff 
-lvtkzlib -lvtkjpeg -lvtkexpat -lvtkGraphicsTCL -lvtkGraphics 
-lvtkImagingTCL -lvtkImaging -lvtkFilteringTCL -lvtkFiltering 
-lvtkCommonTCL -lvtkCommon -framework AppKit -lpthread -lm -framework 
Tcl
ld: warning multiple definitions of symbol _XSetWMClientMachine
/Library/Frameworks/Tk.framework/Tk(ProjectBuilderMasterObjectFile.o) 
definition of _XSetWMClientMachine
/usr/X11R6/lib/libX11.dylib(SetTxtProp.o) definition of 
_XSetWMClientMachine
ld: warning multiple definitions of symbol _XSetIconName
/Library/Frameworks/Tk.framework/Tk(ProjectBuilderMasterObjectFile.o) 
definition of _XSetIconName
....
(many more "multiple definitions" warnings)
....
ld: Undefined symbols:
_glXChooseVisual
_glXCreateContext
_glXDestroyContext
_glXGetClientString
_glXGetConfig
_glXGetCurrentContext
_glXIsDirect
_glXMakeCurrent
_glXQueryExtension
_glXQueryExtensionsString
_glXQueryServerString
_glXSwapBuffers
ld: /Users/gk/vtk/VTK/bin/libvtkpng.a(png.o) illegal reference to 
symbol: _crc32 defined in indirectly referenced dynamic library 
/usr/lib/libz.1.1.3.dylib
make[3]: *** [/Users/gk/vtk/VTK/bin/vtk] Error 1
make[2]: *** [default_target] Error 2
make[1]: *** [default_target_Wrapping_Tcl] Error 2
make: *** [default_target] Error 2

Now, the "illegal reference to symbol: _crc32" I've seen before, and I 
fixed it (based on Mathieu Malaterre's advice) by manually adding "-lz" 
to the end of the link line.  As for the missing _glX symbols, I made 
them go away by manually adding "-lGL" to the link line.  And the "vtk" 
binary compiled!

And then, when I tried to run it, it completely ignored X windows (it 
ran even though I hadn't launched X11 on the mac), and popped up the 
initial wish window, which generated "SetFrontProcess failed,-606" 
error messages when I clicked on it. So it didn't end up using X after 
all, even though I turned off Carbon and Cocoa in cmake:
<http://www.sci.utah.edu/~gk/vtk/CMakeCache.txt>

I would be very grateful for further help in getting a functional 
VTK/Tcl/Tk compiled on a mac.

Gordon




More information about the vtkusers mailing list