[vtkusers] Problem with python wrapping
Armin Wehrfritz
dkxls23 at gmail.com
Mon Mar 30 16:53:57 EDT 2015
Hi David,
Indeed I saw from the VTK source tree that the wrapping is pretty
straight forward using the higher level vtk macros.
I also stumbled across this github repo:
https://github.com/patmarion/PythonWrappedPluginExample
Especially the CMakeLists.txt in Module/Filters looks promising!
Unfortunately I don't have the time right now to look deeper into this,
but maybe it's of help for somebody else.
When I find time for this again, I will post my experience here on the list.
-Armin
On 03/27/2015 06:05 PM, David Gobbi wrote:
> Hi Armin,
>
> Wrapping classes within the VTK source tree itself is pretty trivial.
> Someone should write some cmake macros to make it equally
> trivial for users to wrap their own classes (I'd do it myself, but I've
> already got way too many projects on my plate).
>
> - David
>
> On Fri, Mar 27, 2015 at 9:37 AM, Armin Wehrfritz <dkxls23 at gmail.com
> <mailto:dkxls23 at gmail.com>> wrote:
>
> Thanks a lot for for your help David!
>
> I added some of the missing statements in a quick-and-dirty trial
> and eventually got rid of the real_initvtkMyFilterPython symbol error.
>
> However, I immediately ran into a new symbol error. So I'm still
> missing some linking targets...
>
> I will have a closer look at how it's done in VTK-dicom and see if I
> can figure out what I'm missing.
>
> I should probably also mention that these were my first steps
> compiling a VTK filter and I could be missing some things on that
> end. So far I always used boost for my C++/python coding directly.
>
> Initially I hope the python wrapping in VTK would be as easy as with
> boost, but there really seems to be much more CMAKE code required
> than I thought.
>
> -Armin
>
>
>
>
>
>
> On 03/26/2015 06:44 PM, David Gobbi wrote:
>
> On Thu, Mar 26, 2015 at 10:07 AM, David Gobbi
> <david.gobbi at gmail.com <mailto:david.gobbi at gmail.com>
> <mailto:david.gobbi at gmail.com <mailto:david.gobbi at gmail.com>>__>
> wrote:
>
>
>
> On Thu, Mar 26, 2015 at 9:57 AM, David Gobbi
> <david.gobbi at gmail.com <mailto:david.gobbi at gmail.com>
> <mailto:david.gobbi at gmail.com
> <mailto:david.gobbi at gmail.com>>__> wrote:
>
> On Thu, Mar 26, 2015 at 9:25 AM, Armin Wehrfritz
> <dkxls23 at gmail.com <mailto:dkxls23 at gmail.com>
> <mailto:dkxls23 at gmail.com <mailto:dkxls23 at gmail.com>>> wrote:
>
>
> ImportError: ./vtkMyFilterPython.so: :
> real_initvtkMyFilterPython
>
>
> The undefined symbol error probably means that your python
> module doesn't include vtkMyFilterPythonInit.cxx, which
> is one
> of the files generated by vtk_wrap_python3().
>
> Your cmake should include the Init.cxx as a source file
> when it
> builds the module, e.g.:
>
> add_library(vtkMyFilterPython MODULE
> vtkMyFilterPythonInit.cxx)
>
> Or, if that still doesn't fix the problem, then there
> might be
> an error in your add_library call for vtkMyFilterPythonD.
>
>
> Oh, and the following lines are also necessary, but only if you
> build a static library:
>
> set_target_properties(__vtkMyFilter PROPERTIES
> POSITION_INDEPENDENT_CODE ON)
> set_target_properties(__vtkMyFilterPythonD PROPERTIES
> POSITION_INDEPENDENT_CODE ON)
>
>
> I forgot the the line that is probably the most likely to fix the
> real_initvtkMyFilterPython symbol error:
>
> target_link_libraries(__vtkMyFilterPython vtkMyFilterPythonD)
>
> In summary, a lot of cmake code is needed to get stuff wrapped.
>
> - David
>
>
>
> _________________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/__opensource/opensource.html
> <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 <http://www.vtk.org/Wiki/VTK_FAQ>
>
> Search the list archives at:
> http://markmail.org/search/?q=__vtkusers
> <http://markmail.org/search/?q=vtkusers>
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/__mailman/listinfo/vtkusers
> <http://public.kitware.com/mailman/listinfo/vtkusers>
>
> _________________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/__opensource/opensource.html
> <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 <http://www.vtk.org/Wiki/VTK_FAQ>
>
> Search the list archives at:
> http://markmail.org/search/?q=__vtkusers
> <http://markmail.org/search/?q=vtkusers>
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/__mailman/listinfo/vtkusers
> <http://public.kitware.com/mailman/listinfo/vtkusers>
>
>
More information about the vtkusers
mailing list