[vtkusers] Python wrapping (outside VTK source tree), almost there

Paul Melis paul.melis at surfsara.nl
Mon Jul 27 06:05:43 EDT 2015

Hi all,

I'm trying to get a custom interactor (deriving from vtkInteractorStyle) 
wrapped in Python with VTK 6.2. This is with building the wrappers 
outside of the VTK source tree.

I managed to piece together a set of cmake commands that at least 
generates wrapper code and compiles ok, based on 
http://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ and other sources.

But it seems at least one of the Python-wrapped VTK libraries is not 
linked in, causing the module load in Python to fail:

$ py -c 'import vtkGamepadPython'
Traceback (most recent call last):
   File "<string>", line 1, in <module>
ImportError: ./vtkGamepadPython.so: undefined symbol: 

The missing symbol is in the libvtkRenderingCorePython library:

$ nm -C -D 
~/software/vtk-6.2.0-opengl2/lib/libvtkRenderingCorePython27D-6.2.so|grep PyVTKClass_vtkInteractorStyleNew
0000000000161aa0 T PyVTKClass_vtkInteractorStyleNew

But the other wrapping examples I find on the web don't seem to 
explicitly add linking of ...Python?D... libraries, so I figure I'm 
missing some variable or other in the cmake calls somewhere that 
implicitly adds extra dependencies.

As the whole wrapping infrastructure feels quite fragile already, I'd 
rather not add all kinds of hacks to get it working :)

So if somebody knows The Right Way (TM) to get VTK wrapping in this 
situation to work...

The relevant cmake code is at

The full code (just a few files) is at 



Paul Melis
| Visualization group leader & developer | SURFsara |
| Science Park 140 | 1098 XG Amsterdam |
| T 020 800 1312 | paul.melis at surfsara.nl | www.surfsara.nl |

More information about the vtkusers mailing list