[vtkusers] Building VTK 7.1.1 with Python wrapping fail

Timothee Evain tevain at telecom-paristech.fr
Tue May 2 15:38:03 EDT 2017


Hello David,

Some follow-up: 

After vtkPythonWrapping.cmake modification, the first set of error is gone.
But then, linking fail for this project with:
[...]
1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol initvtkCommonCorePython referenced in function "void __cdecl vtkpythonmodulesPythonLoadAllPythonModules(void)" (?vtkpythonmodulesPythonLoadAllPythonModules@@YAXXZ)
1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol initvtkCommonMathPython referenced in function "void __cdecl vtkpythonmodulesPythonLoadAllPythonModules(void)" (?vtkpythonmodulesPythonLoadAllPythonModules@@YAXXZ)
1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol initvtkCommonMiscPython referenced in function "void __cdecl vtkpythonmodulesPythonLoadAllPythonModules(void)" (?vtkpythonmodulesPythonLoadAllPythonModules@@YAXXZ)
[...]

Looking at the the vtkpython linking dependencies, I'm a bit confused.
First of all, the python lib ([...]Python_3.6.1\libs\python36.lib) is set for release profile but also on debug (rather than [...]Python_3.6.1\libs\python36_d.lib ?) by cmake.
Then, for both profiles are linked all the vtk*Python and all the vtk*PythonD libs, which seems unusual, as I was expecting vtk*Python libs in release and vtk*PythonD libs in debug.
I'm not sure if this is an expected configuration, so I have not found the source of error.

Don't hesitate to tell me if you need additionnal information!

Tim

----- Mail original -----
De: "David Gobbi" <david.gobbi at gmail.com>
À: "Timothee Evain" <tevain at telecom-paristech.fr>
Cc: "VTK Users" <vtkusers at vtk.org>, "Utkarsh Ayachit" <utkarsh.ayachit at kitware.com>
Envoyé: Lundi 1 Mai 2017 21:52:21
Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail

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
>>
>


More information about the vtkusers mailing list