[vtkusers] Building VTK 7.1.1 with Python wrapping fail

David Gobbi david.gobbi at gmail.com
Mon May 1 15:52:21 EDT 2017


Hi Tim,

As a temporary work-around, you can try modifying the VTK code yourself.
In the VTK/CMake directory, there is a file called
vtkPythonWrapping.cmake.  The following line (around line 195) is where the
problem is:

      set (EXTERN_DEFINES "${EXTERN_DEFINES}\n  extern void
init${module}Python();")

Try changing the "void" to "PyObject *":

      set (EXTERN_DEFINES "${EXTERN_DEFINES}\n  extern PyObject
*init${module}Python();")

Let me know if that fixes the compile error.

 - David

On Mon, May 1, 2017 at 1:24 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Tim,
>
> I haven't seen this error message before, but my guess is that building
> the Python wrappers with static linkage does not work with Python 3.  I'm
> not sure how difficult this is to fix.  It might be as simple as adding a
> couple #ifdefs to the code (to the VTK code, I mean.).
>
>  - David
>
>
> On Mon, May 1, 2017 at 12:26 PM, Timothee Evain <
> tevain at telecom-paristech.fr> wrote:
>
>> Hello everyone!
>>
>> I'm trying to build VTK 7.1.1 with the Python wrapping with Visual studio
>> 2017 on Win10. Everything goes fine until the end of the build, where a
>> bunch of error appears in the vtkpython project like :
>>
>> vtkPythonAppInit.cxx
>> ...\VTK_7.1.1\Wrapping\Python\vtkpythonmodules.h(126): error C2664: 'int
>> PyImport_AppendInittab(const char *,PyObject *(__cdecl *)(void))': cannot
>> convert argument 2 from 'void (__cdecl *)(void)' to 'PyObject *(__cdecl
>> *)(void)'
>> ...\VTK_7.1.1\Wrapping\Python\vtkpythonmodules.h(126): note: None of the
>> functions with this name in scope match the target type
>> ...\VTK_7.1.1\Wrapping\Python\vtkpythonmodules.h(129): error C2664: 'int
>> PyImport_AppendInittab(const char *,PyObject *(__cdecl *)(void))': cannot
>> convert argument 2 from 'void (__cdecl *)(void)' to 'PyObject *(__cdecl
>> *)(void)'
>> ...\VTK_7.1.1\Wrapping\Python\vtkpythonmodules.h(129): note: None of the
>> functions with this name in scope match the target type
>>
>> and so on. The only similar error in the mailing list is
>> http://vtk.1045678.n5.nabble.com/VtK-7-python3-4-build-error
>> -td5735728.html ; but that doesn't help me since my python path are
>> correctly set.
>>
>> The building config is :
>> Windows 10 x64
>> Visual Studio 2017
>> Python 3.6.1 (installed from python.org exe)
>> VTK 7.1.1 with :
>> -PYTHON_DEBUG_LIBRARY C:/Program Files/Python_3.6.1/libs/python36_d.lib
>> -PYTHON_EXECUTABLE C:/Program Files/Python_3.6.1/python.exe
>> -PYTHON_INCLUDE_DIR C:/Program Files/Python_3.6.1/include
>> -PYTHON_LIBRARY C:/Program Files/Python_3.6.1/libs/python36.lib
>> (-Static libraries)
>>
>> Anyone have already encountered such problems and solved it ?
>>
>> Thanks in advance.
>>
>> Tim
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170501/d9ae06e7/attachment.html>


More information about the vtkusers mailing list