[vtkusers] VTK static link with Qt app on Mac OS X

Clinton Stimpson clinton at elemtech.com
Mon Sep 27 10:06:12 EDT 2010


Qt 4.5 and later support both Cocoa and Carbon.  You have to pick one 
when configuring (the default is still Carbon).

That VTK even built without problems indicates Qt and VTK configured 
correctly.

Gib, you just need to add "-framework Carbon" to your link command.

Clint

On 09/27/2010 06:51 AM, David Gobbi wrote:
> Hi Gib,
>
> You should probably be building VTK with VTK_USE_COCOA=ON. Qt 4.5 and
> later use Cocoa, older versions of Qt use Carbon.  VTK must be built
> with the GUI toolkit that Qt uses.
>
>    David
>
>
> On Mon, Sep 27, 2010 at 3:13 AM, André Prins<a.h.prins at gmail.com>  wrote:
>> Hi Gib,
>>
>> Although I am not a Mac user, my first guess would be that you are
>> missing some Apple/Mac libraries when linking. Perhaps -lAGL -lCocoa
>> (or -lCarbon).
>>
>> You could try to google for the exact libraries corresponding to the
>> missing symbols. Alternatively, you could check which libraries were
>> used to link vtkRendering.
>>
>> Regards,
>> Andre
>>
>> On Mon, Sep 27, 2010 at 8:11 AM, Gib Bogle<g.bogle at auckland.ac.nz>  wrote:
>>> Almost there ... having got the linking of static VTK library with my Qt app
>>> (shared Qt libraries) working on Linux, I'm now trying to do the same thing
>>> on Mac OS X.  As before, I first got the shared VTK case working.  I then
>>> built the static VTK libraries, and added all those not already there to the
>>> LIBS list in Qt Creator, which now looks like this:
>>>
>>> LIBS += -L/Users/mbog002/code/VTK-static/bin -lQVTK -lvtkRendering
>>> -lvtkGraphics  -lvtkIO \
>>> -lvtkCommon -lvtkInfovis -lvtkViews -lvtkWidgets -lvtkHybrid -lvtkParallel
>>> -lvtkverdict \
>>> -lvtkftgl -lvtkfreetype -lvtkNetCDF -lvtkmetaio -lvtksqlite -lvtkpng
>>> -lvtkzlib \
>>> -lvtkjpeg -lvtktiff -lvtkexpat -lVPIC -lCosmo -lvtkexoIIc -lvtklibxml2
>>> -lvtkalglib \
>>> -lvtkVolumeRendering -lvtkFiltering -lvtkImaging -lvtksys -lvtkQtChart \
>>> -lGL -lGLU -lglut
>>>
>>> This generates a large number of "undefined symbol" link errors.  Here is a
>>> sample (sorry about the formatting):
>>>
>>> Undefined symbols:
>>>   "_HIViewGetViewForMouseEvent", referenced from:
>>>       myWinEvtHndlr(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*)  in
>>> libvtkRendering.a(vtkCarbonRenderWindowInteractor.cxx.o)
>>>   "_HIViewFindByID", referenced from:
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::CreateAWindow()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_aglSetCurrentContext", referenced from:
>>>       vtkCarbonRenderWindow::MakeCurrent()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::MakeCurrent()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::DestroyWindow()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::CreateOffScreenWindow(int, int)in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::CreateAWindow()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_aglSetOffScreen", referenced from:
>>>       vtkCarbonRenderWindow::CreateOffScreenWindow(int, int)in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_GetWindowPort", referenced from:
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::CreateAWindow()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_aglDisable", referenced from:
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_GetControlRegion", referenced from:
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_HIViewConvertRect", referenced from:
>>>       vtkCarbonRenderWindow::UpdateGLRegion()       in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_aglChoosePixelFormat", referenced from:
>>>       vtkCarbonRenderWindowInternal::ChoosePixelFormat(int, int, int, int,
>>> int, int, int)in libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>       vtkCarbonRenderWindowInternal::CreateContext(int, int&, int&, int&,
>>> int&, int&, char const*&)in libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_MoveWindow", referenced from:
>>>       vtkCarbonRenderWindow::SetPosition(int, int)in
>>> libvtkRendering.a(vtkCarbonRenderWindow.cxx.o)
>>>   "_CGGetLastMouseDelta", referenced from:
>>>       vtkCarbonLeaveCheck(__EventLoopTimer*, void*) in
>>> libvtkRendering.a(vtkCarbonRenderWindowInteractor.cxx.o)
>>>       myWinEvtHndlr(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*)  in
>>> libvtkRendering.a(vtkCarbonRenderWindowInteractor.cxx.o)
>>>   "___CFConstantStringClassReference", referenced from:
>>>       cfstring=VRAM,totalsize in
>>> libvtkRendering.a(vtkCoreGraphicsGPUInfoList.cxx.o)
>>>
>>> When I built the static VTK libraries I used exactly the same ccmake
>>> configure settings as for the shared libraries, except of course for
>>> BUILD_SHARED_LIBS. Is this the right thing to do? If the VTK build is OK I
>>> must be missing some libraries, but what?  Are these X11 functions?  Thanks
>>> in advance for suggestions.
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list