[vtkusers] OSX 10.6 TCL issue "libvtkRendering.5.4.dylib: GC capability mismatch" ( solution too )

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Mar 3 10:00:32 EST 2010


Hello,

I was getting the following error:

>$ wish
% package require vtk
dlopen(~/local/lib/vtk-5.4/libvtkRenderingTCL.dylib, 10): Library not loaded: libvtkRendering.5.4.dylib
  Referenced from: ~/local/lib/vtk-5.4/libvtkRenderingTCL.dylib
  Reason: no suitable image found.  Did find:
	libvtkRendering.5.4.dylib: GC capability mismatch
attempt to provide package vtkRenderingTCL 5.4 failed: no version of package vtkRenderingTCL provided
attempt to provide package vtkrendering 5.4 failed: no version of package vtkrendering provided
attempt to provide package vtk 5.4 failed: no version of package vtk provided

The solution was to define the following CMake variable:

-D VTK_REQUIRED_OBJECTCXX_FLAGS:STRING=-fobjc-gc

I tried many different combinations of deployment targets, architecture, and cocoa vs carbon. In the end I have gotten it working for "i386;x86_64", the default 10.6 deployment target, cocoa, and tcl enabled.

I am not a OBJC expert but it appears that with the Apple Snow Leopard (10.6) this flag may be needed for objc libraries for Garbage Collection compatibility. ( I wish google was smart enough to do a better job with two character searches "GC" ) I discovered the compatibility issue with the Tcl/Tk library, the question remains what other libraries will this also be a problem with?


=Solution? =

The -fobjc-gc should be added to the default OBJC arguments for the appropriate OS versions..

From: http://developer.apple.com/mac/library/releasenotes/DeveloperTools/RN-Xcode/

The Objective-C Garbage Collection setting enables compiling and linking Objective-C code for automatic garbage collection. It has three states: Unsupported disables garbage collection; Required (-fobjc-gc-only) will create an executable that runs only on Mac OS X 10.5 and later and will always run garbage collected; and Supported (-fobjc-gc) will create an executable that can run either garbage collected or not, depending on how the user chooses to launch it or, in the case of libraries and frameworks, whether the invoking application is using garbage collection.

I am running cmake 2.6. But cmake appears not to even support the flags correctly:
http://public.kitware.com/Bug/view.php?id=4756

So likely the easies solution would be just to handle this inside VTK CMakeLists.txt

Thanks,
Brad


========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100303/69ff0cda/attachment.htm>


More information about the vtkusers mailing list