[vtk-developers] VTK-carbon on OS X 10.6

David Gobbi david.gobbi at gmail.com
Tue Sep 22 18:02:24 EDT 2009

On Tue, Sep 22, 2009 at 2:50 PM, Sean McBride <sean at rogue-research.com> wrote:
> On 9/22/09 2:07 PM, David Gobbi said:
>>I'm experiencing some difficulties with VTK 5.4 with the newest
>>version of OS X, specifically with VTK_USE_CARBON.  The cocoa and x11
>>builds seem to work fine, but I need carbon for the vtkTkRenderWidget.
>>My build options are straightforward:
>>CMAKE_C_FLAGS = -m32
> Those are unusual.  Are you trying to tell it to build 32 bit?  If so,
> you should use '-arch i386'.

They're what I use on Linux, but thanks for the hint, I'll start using
"-arch i386" for the mac.  It has to be 32-bit for Carbon.

>>The first problem is a compile problem, vtkTkRenderWidget.cxx
>>complains about needing "OpaqueGrafPtr *" instead of "void *", but
>>adding a typecast made the problem go away.
> Which line?

Line 1152 in vtkTkRenderWidget.cxx and line 822 in
vtkTkImageViewerWidget.cxx, both needed typecasts as follows:

parentWin = GetWindowFromPort((OpaqueGrafPtr*)TkMacOSXGetDrawablePort(

This code is only compiled when VTK_WRAP_TCL and VTK_USE_CARBON are
set, and AFAIK the type casts are only needed under OS X 10.6.

>>The more serious problems occur at runtime.  When I ran "make test",
>>all the windows were displayed without decorations (i.e. no title
>>bar).  Furthermore, when I tried using vtkTkRenderWidget, the
>>vtkRenderWindow would not bind to the Widget.  I'd get a blank Widget
>>from tk, and a separate vtkRenderWindow sitting underneath.
>>Has anyone else been using carbon with VTK on OS X 10.6?  I never used
>>10.5, so I don't know if these issues are new.
> I haven't.  But I know the Tcl/Tk version included in 10.6 is newer than
> in 10.5.
> cd /System/Library/Frameworks/Tcl.framework/Versions
> drwxr-xr-x  11 root  wheel  374  4 Sep 11:20 8.4
> drwxr-xr-x  11 root  wheel  374  4 Sep 11:20 8.5
> lrwxr-xr-x   1 root  wheel    3 14 Aug 10:00 Current -> 8.5
> and on 10.5:
> drwxr-xr-x  9 root  wheel  306 16 Sep 16:28 8.4
> lrwxr-xr-x  1 root  wheel    3  6 Dec  2008 Current -> 8.4
> Forgive my ignorance, I know next to nothing of Tcl/Tk... does
> vtkTkRenderWidget only support Carbon and not Cocoa?  Why do you need to
> build VTK using Carbon?

Because on the mac, Tk is built with Carbon.  There is an experimental
version of Tk that uses Cocoa that I'm going to try, but of course the
OS X Tk code in VTK is Carbon specific, so VTK won't be able to use it
without some serious modifications.

> Anyway, perhaps you can try linking to the 8.4 version (on 10.6) and see
> if that changes something.

That sounds like the easiest thing to do.  Hopefully one of the older
versions of python on OS X is linked to 8.4, otherwise I'm stuck with

Thanks a bundle,


More information about the vtk-developers mailing list