[vtkusers] Python wrapping example won't build on Mac OS X
Sander Niemeijer
niemeijer at science-and-technology.nl
Tue Mar 16 03:19:39 EST 2004
You should at least link against the vtkCommonPythonD library, since
this contains the VTK Python Utility code (from
VTK/Common/vtkPythonUtil.cxx). If you are deriving classes from other
VTK classes you probably also need to link against the vtk*PythonD
libraries that contain the Python wrappings for the base classes.
Regards,
Sander
On maandag, maa 15, 2004, at 20:47 Europe/Amsterdam, Theodore D.
Sternberg wrote:
> On Mon, 15 Mar 2004, Theodore D. Sternberg wrote:
>> Good idea ;-) Here's an attempt at doing that:
>>
>> IF (VTK_WRAP_PYTHON)
>> VTK_WRAP_PYTHON2(${PROJECT_NAME}Python vtkLocalPYTHON_SRCS
>> ${vtkLocal_SRCS})
>> IF (APPLE)
>> ADD_LIBRARY(${PROJECT_NAME}PythonD ${vtkLocalPYTHON_SRCS})
>> ADD_LIBRARY(${PROJECT_NAME}Python MODULE
>> ${PROJECT_NAME}PythonInit.cxx)
>> TARGET_LINK_LIBRARIES(${PROJECT_NAME}PythonD ${PROJECT_NAME}
>> TARGET_LINK_LIBRARIES(${PROJECT_NAME}Python
>> ${PROJECT_NAME}PythonD)
>> INSTALL_TARGETS(/lib/vtk ${PROJECT_NAME}PythonD)
>> ELSE (APPLE)
>> ADD_LIBRARY(${PROJECT_NAME}Python MODULE ${vtkLocalPYTHON_SRCS}
>> TARGET_LINK_LIBRARIES (${PROJECT_NAME}Python vtkLocalPython
>> ${PROJECT_NAME})
>> ENDIF(APPLE)
>> INSTALL_TARGETS(/lib/vtk ${PROJECT_NAME}Python)
>> ENDIF (VTK_WRAP_PYTHON)
>>
>> Now, something is still wrong. Maybe you can see what it is. When I
>> try
>> building on Mac OS X it gets pretty far and finally fails with...
>>
>> Building shared library
>> /Users/ted/vtk-wrap-example/build/bin/libvtkLocalPythonD.dylib...
>> /usr/local/bin/cmake -E remove -f
>> /Users/ted/vtk-wrap-example/build/bin/libvtkLocalPythonD.dylib
>> c++ -dynamiclib -o
>> /Users/ted/vtk-wrap-example/build/bin/libvtkLocalPythonD.dylib
>> vtkLocalExamplePython.o vtkLocalPythonInit.o vtkLocalExamplePython.o
>> -L/Users/ted/usr/vtk/lib/vtk -L/Users/ted/vtk-wrap-example/build/bin
>> -lvtkLocal -lvtkCommon -framework AppKit -lpthread -lm
>> ld: multiple definitions of symbol _PyVTKClass_vtkLocalExampleNew
>> vtkLocalExamplePython.o definition of _PyVTKClass_vtkLocalExampleNew
>> in section (__TEXT,__text)
>> vtkLocalExamplePython.o definition of _PyVTKClass_vtkLocalExampleNew
>> in section (__TEXT,__text)
>> /usr/bin/libtool: internal link edit command failed
>
> Clearly, the immediate problem here is that vtkLocalExamplePython.o
> appears twice on the link line. Maybe vtkLocalExamplePython.cxx is
> somehow winding up twice in ${vtkLocalPYTHON_SRCS}?
>
> If I remove (via cut & paste -- but I'd welcome a solution via the
> CMakeLists file) one of those vtkLocalExamplePython.o's from the link
> line, it then complains about not finding a bunch of Python library
> functions -- _PyArg_ParseTuple and such. So I added "-framework
> Python"
> to the link line. That cut down the number of undefined symbols to a
> bunch that are supposed to come from VTK -- _PyArg_VTKParseTuple,
> _PyVTKClass_Check, ...
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list