[vtkusers] Issue with python wrapping in derived libraries

Kit Chambers kit.chambers.kc at gmail.com
Mon Dec 10 05:24:09 EST 2018


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 <kit.chambers.kc at gmail.com>
> To: VTK Users <vtkusers at vtk.org>
> Subject: [vtkusers] Issue with python wrapping in derived libraries
> Message-ID: <51B5DD2E-9E32-42C9-AA97-82D9A2BA34A5 at googlemail.com>
> 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



More information about the vtkusers mailing list