[vtkusers] Problem with python wrapping
Armin Wehrfritz
dkxls23 at gmail.com
Fri Mar 27 11:37:53 EDT 2015
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>> wrote:
>
>
>
> On Thu, Mar 26, 2015 at 9:57 AM, David Gobbi <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>> 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
>
> Visit other Kitware open-source projects at 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list