[vtkusers] Qt+VTK on OSX: illegal hardware instruction

Sensei senseiwa at gmail.com
Wed Mar 6 10:02:08 EST 2013


On 3/5/13 4:59pm, Sean McBride wrote:
> On OS X, an application can be garbage collected or not, and this
> choice is per-process.  Any libraries linked into an executable must
> therefore be built with the correct garbage collection flag.  Library
> code, like VTK or indeed Cocoa.framework itself, needs to be prepared
> to work with both GC and non-GC apps; for this reason, by default,
> VTK is built with -fobjc-gc which indicates that it is 'GC ready, but
> not GC-required'.  (-fobjc-gc-only means 'GC required').
>
> Somehow, somewhere, you have a mismatch of GC flags in one or more of
> the libraries your application links to.



Thanks for your answer, Sean.


Yes, that I know already. The reason I'm writing this is that I built an 
example from the VTK source, vanilla, no modifications at all. The same 
goes for VTK itself.

However, I think the problem is with CMake trying to use GCC instead of 
clang, and maybe using libc++ instead of the older libstdc++ (or some 
sort of back-compatibility issue).


If I ask to generate a Xcode project, I get an error:

CMake Error at 
/Applications/Development/cmake/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 
(MESSAGE):
   The C compiler "/usr/bin/gcc" is not able to compile a simple test 
program.

   It fails with the following output:

    Change Dir: 
/Users/sensei/Downloads/VTK5.10.1/Examples/GUI/Qt/GraphicsView/b/CMakeFiles/CMakeTmp



   Run Build Command:/Applications/Development/cmake/bin/cmakexbuild 
-project
   CMAKE_TRY_COMPILE.xcode build -target cmTryCompileExec -buildstyle
   Development

   xcodebuild: error: option '-buildstyle' is no longer supported



I created a new Xcode project using VTK, linked all libraries by hand, 
and it links and runs.



Thanks!





More information about the vtkusers mailing list