Issue with python wrapping in derived libraries

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with python wrapping in derived libraries

Kit Chambers

I am having and issue where by libraries built on top of VTK and wrapped using the vtkPython wrapping are not being imported properly. 

Essentially I have 2 projects:

project1/ - Contains vtkmodule1 and extends vtkImageData to define the object vtkCube. The object vtkCube1 implements a method CustomMethod1

project2/ - Contains vtkmodule2 and extends vtkCube1 to define the object vtkCube2. The object vtkCube2 then implements a method CustomMethod2 

Compiling and wrapping the libraries works fine except for when you try to access CustomMethod1 from the python wrapped vtkCube2. Essentially the vtkCube2 object misses out all the members of vtkCube1.


To help show/explain I created a git repo which replicates the issue here 

https://github.com/batearedcollie/test-vtkwrap-shared

There is also a docker image which replicates the issue here  



Any ideas or help would be greatly appreciated

Thanks



_______________________________________________
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:
https://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Issue with python wrapping in derived libraries

Kit Chambers
Dear VTK’ers

After some more investigation I think I have solved this issue. I thought i would mention this here in the hope this benefits other in the future.

Essentially the procedure I have for building a python module was

1- Use vtk_python_wrap3 to generate source files
2- Compile the source files into a static library called MODULENAMPythonD.a
3- Create the Python module (MODULENAME.so) itself by compiling the MODULENAMInit.cxx and linking against MODULENAMPythonD.a

The solution was to change step 2 so that a shared library MODULENAMPythonD.so was built instead. Note - I suspect this solution is system dependent and has only been tested on Ubuntu so far.


>
>
> ------------------------------
>
> Message: 6
> Date: Thu, 6 Dec 2018 13:38:29 +0000
> From: Kit Chambers <[hidden email]>
> To: VTK Users <[hidden email]>
> Subject: [vtkusers] Issue with python wrapping in derived libraries
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="us-ascii"
>
>
> I am having and issue where by libraries built on top of VTK and wrapped using the vtkPython wrapping are not being imported properly.
>
> Essentially I have 2 projects:
>
> project1/ - Contains vtkmodule1 and extends vtkImageData to define the object vtkCube. The object vtkCube1 implements a method CustomMethod1
>
> project2/ - Contains vtkmodule2 and extends vtkCube1 to define the object vtkCube2. The object vtkCube2 then implements a method CustomMethod2
>
> Compiling and wrapping the libraries works fine except for when you try to access CustomMethod1 from the python wrapped vtkCube2. Essentially the vtkCube2 object misses out all the members of vtkCube1.
>
>
> To help show/explain I created a git repo which replicates the issue here
>
> https://github.com/batearedcollie/test-vtkwrap-shared <https://github.com/batearedcollie/test-vtkwrap-shared>
>
> There is also a docker image which replicates the issue here  
>
> https://hub.docker.com/r/batearedcollie/vtkwrappingissue/ <https://hub.docker.com/r/batearedcollie/vtkwrappingissue/>
>
>
> Any ideas or help would be greatly appreciated
>
> Thanks

_______________________________________________
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:
https://public.kitware.com/mailman/listinfo/vtkusers