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

Paul Melis paul.melis at surfsara.nl
Mon Jul 27 09:33:46 EDT 2015


Thanks for the quick reply, David. That indeed was the missing piece of 
information, it works now!

Paul

On 27-07-15 15:03, David Gobbi wrote:
> Hi Paul,
>
> The list of PythonD libraries that you need to link is not exported, but
> it can be built from a list of the modules that you derived your own
> classes from, e.g.:
>
>    set(VTK_MODULES_USED vtkInteractionStyle)
>    set(VTK_PYTHOND_LIBS)
>    foreach(TMP_LIB ${VTK_MODULES_USED})
>      set(VTK_PYTHOND_LIBS ${VTK_PYTHOND_LIBS} ${TMP_LIB}PythonD)
>    endforeach()
>
>   - David
>
> On Mon, Jul 27, 2015 at 4:05 AM, Paul Melis <paul.melis at surfsara.nl
> <mailto:paul.melis at surfsara.nl>> wrote:
>
>     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:
>     PyVTKClass_vtkInteractorStyleNew
>
>     The missing symbol is in the libvtkRenderingCorePython library:
>
>     $ nm -C -D
>     ~/software/vtk-6.2.0-opengl2/lib/libvtkRenderingCorePython27D-6.2.so
>     <http://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
>     https://github.com/paulmelis/vtk-wrapping-example/blob/master/src/CMakeLists.txt
>
>     The full code (just a few files) is at
>     https://github.com/paulmelis/vtk-wrapping-example
>
>     Regards,
>     Paul
>
>     --
>
>     Paul Melis
>     | Visualization group leader & developer | SURFsara |
>     | Science Park 140 | 1098 XG Amsterdam |
>     | T 020 800 1312 | paul.melis at surfsara.nl
>     <mailto:paul.melis at surfsara.nl> | www.surfsara.nl
>     <http://www.surfsara.nl> |
>
>


-- 

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