[vtkusers] Problem with python wrapping
David Gobbi
david.gobbi at gmail.com
Fri Mar 27 12:05:16 EDT 2015
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> 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>> 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
>>
>> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150327/44d667a3/attachment.html>
More information about the vtkusers
mailing list