<div dir="ltr"><div>Hi Paul,</div><div><br></div><div>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.: </div><div><br></div><div> set(VTK_MODULES_USED vtkInteractionStyle) </div><div> set(VTK_PYTHOND_LIBS)</div><div> foreach(TMP_LIB ${VTK_MODULES_USED})</div><div> set(VTK_PYTHOND_LIBS ${VTK_PYTHOND_LIBS} ${TMP_LIB}PythonD)</div><div> endforeach()</div><div><br></div><div> - David</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 27, 2015 at 4:05 AM, Paul Melis <span dir="ltr"><<a href="mailto:paul.melis@surfsara.nl" target="_blank">paul.melis@surfsara.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
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.<br>
<br>
I managed to piece together a set of cmake commands that at least generates wrapper code and compiles ok, based on <a href="http://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK/Python_Wrapping_FAQ</a> and other sources.<br>
<br>
But it seems at least one of the Python-wrapped VTK libraries is not linked in, causing the module load in Python to fail:<br>
<br>
$ py -c 'import vtkGamepadPython'<br>
Traceback (most recent call last):<br>
File "<string>", line 1, in <module><br>
ImportError: ./vtkGamepadPython.so: undefined symbol: PyVTKClass_vtkInteractorStyleNew<br>
<br>
The missing symbol is in the libvtkRenderingCorePython library:<br>
<br>
$ nm -C -D ~/software/vtk-6.2.0-opengl2/lib/<a href="http://libvtkRenderingCorePython27D-6.2.so" rel="noreferrer" target="_blank">libvtkRenderingCorePython27D-6.2.so</a>|grep PyVTKClass_vtkInteractorStyleNew<br>
0000000000161aa0 T PyVTKClass_vtkInteractorStyleNew<br>
<br>
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.<br>
<br>
As the whole wrapping infrastructure feels quite fragile already, I'd rather not add all kinds of hacks to get it working :)<br>
<br>
So if somebody knows The Right Way (TM) to get VTK wrapping in this situation to work...<br>
<br>
The relevant cmake code is at<br>
<a href="https://github.com/paulmelis/vtk-wrapping-example/blob/master/src/CMakeLists.txt" rel="noreferrer" target="_blank">https://github.com/paulmelis/vtk-wrapping-example/blob/master/src/CMakeLists.txt</a><br>
<br>
The full code (just a few files) is at <a href="https://github.com/paulmelis/vtk-wrapping-example" rel="noreferrer" target="_blank">https://github.com/paulmelis/vtk-wrapping-example</a><br>
<br>
Regards,<br>
Paul<br>
<br>
-- <br>
<br>
Paul Melis<br>
| Visualization group leader & developer | SURFsara |<br>
| Science Park 140 | 1098 XG Amsterdam |<br>
| T 020 800 1312 | <a href="mailto:paul.melis@surfsara.nl" target="_blank">paul.melis@surfsara.nl</a> | <a href="http://www.surfsara.nl" rel="noreferrer" target="_blank">www.surfsara.nl</a> |<br>
</blockquote></div><br></div></div>