<div dir="ltr">Hi Timothee,<div><br></div><div>The "D" on the the vtk*PythonD does not mean "Debug".  Each build (whether release or debug) will have a full set of vtk*PythonD libraries and vtk*Python modules.  Both are needed for the VTK build.</div><div><br></div><div>My system doesn't have a python_d debug library (I'm OS X), but it is probably unrelated to the link error, and it is totally unrelated to the PythonD libraries.</div><div><br></div><div>As for the link error, it probably has to do with these lines in Wrapping/Python/CMakeLists.txt:</div><div><br></div><div><div>  list(APPEND VTKPYTHON_LINK_LIBS ${vtkPython_LIBRARIES})</div><div>  target_link_libraries(vtkpython ${VTKPYTHON_LINK_LIBS})</div></div><div><br></div><div>Can you add the following immediately below these lines, and tell me what is printed?</div><div><br></div><div>  message(STATUS "vtkPython_LIBRARIES ${vtkPython_LIBRARIES}")</div><div>  message(STATUS "VTKPYTHON_LINK_LIBS ${VTKPYTHON_LINK_LIBS}")</div><div><br></div><div>Regards,</div><div> - David</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 2, 2017 at 1:38 PM, Timothee Evain <span dir="ltr"><<a href="mailto:tevain@telecom-paristech.fr" target="_blank">tevain@telecom-paristech.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello David,<br>
<br>
Some follow-up:<br>
<br>
After vtkPythonWrapping.cmake modification, the first set of error is gone.<br>
But then, linking fail for this project with:<br>
[...]<br>
1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol initvtkCommonCorePython referenced in function "void __cdecl vtkpythonmodulesPythonLoadAllP<wbr>ythonModules(void)" (?<wbr>vtkpythonmodulesPythonLoadAllP<wbr>ythonModules@@YAXXZ)<br>
1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol initvtkCommonMathPython referenced in function "void __cdecl vtkpythonmodulesPythonLoadAllP<wbr>ythonModules(void)" (?<wbr>vtkpythonmodulesPythonLoadAllP<wbr>ythonModules@@YAXXZ)<br>
1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol initvtkCommonMiscPython referenced in function "void __cdecl vtkpythonmodulesPythonLoadAllP<wbr>ythonModules(void)" (?<wbr>vtkpythonmodulesPythonLoadAllP<wbr>ythonModules@@YAXXZ)<br>
[...]<br>
<br>
Looking at the the vtkpython linking dependencies, I'm a bit confused.<br>
First of all, the python lib ([...]Python_3.6.1\libs\<wbr>python36.lib) is set for release profile but also on debug (rather than [...]Python_3.6.1\libs\<wbr>python36_d.lib ?) by cmake.<br>
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.<br>
I'm not sure if this is an expected configuration, so I have not found the source of error.<br>
<br>
Don't hesitate to tell me if you need additionnal information!<br>
<span class="im HOEnZb"><br>
Tim<br>
<br>
----- Mail original -----<br>
De: "David Gobbi" <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
À: "Timothee Evain" <<a href="mailto:tevain@telecom-paristech.fr">tevain@telecom-paristech.fr</a>><br>
Cc: "VTK Users" <<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>>, "Utkarsh Ayachit" <<a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>><br>
Envoyé: Lundi 1 Mai 2017 21:52:21<br>
Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail<br>
<br>
</span><div class="HOEnZb"><div class="h5">Hi Tim,<br>
<br>
As a temporary work-around, you can try modifying the VTK code yourself.<br>
In the VTK/CMake directory, there is a file called<br>
vtkPythonWrapping.cmake.  The following line (around line 195) is where the<br>
problem is:<br>
<br>
      set (EXTERN_DEFINES "${EXTERN_DEFINES}\n  extern void<br>
init${module}Python();")<br>
<br>
Try changing the "void" to "PyObject *":<br>
<br>
      set (EXTERN_DEFINES "${EXTERN_DEFINES}\n  extern PyObject<br>
*init${module}Python();")<br>
<br>
Let me know if that fixes the compile error.<br>
<br>
 - David<br>
<br>
On Mon, May 1, 2017 at 1:24 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
<br>
> Hi Tim,<br>
><br>
> I haven't seen this error message before, but my guess is that building<br>
> the Python wrappers with static linkage does not work with Python 3.  I'm<br>
> not sure how difficult this is to fix.  It might be as simple as adding a<br>
> couple #ifdefs to the code (to the VTK code, I mean.).<br>
><br>
>  - David<br>
><br>
><br>
> On Mon, May 1, 2017 at 12:26 PM, Timothee Evain <<br>
> <a href="mailto:tevain@telecom-paristech.fr">tevain@telecom-paristech.fr</a>> wrote:<br>
><br>
>> Hello everyone!<br>
>><br>
>> I'm trying to build VTK 7.1.1 with the Python wrapping with Visual studio<br>
>> 2017 on Win10. Everything goes fine until the end of the build, where a<br>
>> bunch of error appears in the vtkpython project like :<br>
>><br>
>> vtkPythonAppInit.cxx<br>
>> ...\VTK_7.1.1\Wrapping\Python\<wbr>vtkpythonmodules.h(126): error C2664: 'int<br>
>> PyImport_AppendInittab(const char *,PyObject *(__cdecl *)(void))': cannot<br>
>> convert argument 2 from 'void (__cdecl *)(void)' to 'PyObject *(__cdecl<br>
>> *)(void)'<br>
>> ...\VTK_7.1.1\Wrapping\Python\<wbr>vtkpythonmodules.h(126): note: None of the<br>
>> functions with this name in scope match the target type<br>
>> ...\VTK_7.1.1\Wrapping\Python\<wbr>vtkpythonmodules.h(129): error C2664: 'int<br>
>> PyImport_AppendInittab(const char *,PyObject *(__cdecl *)(void))': cannot<br>
>> convert argument 2 from 'void (__cdecl *)(void)' to 'PyObject *(__cdecl<br>
>> *)(void)'<br>
>> ...\VTK_7.1.1\Wrapping\Python\<wbr>vtkpythonmodules.h(129): note: None of the<br>
>> functions with this name in scope match the target type<br>
>><br>
>> and so on. The only similar error in the mailing list is<br>
>> <a href="http://vtk.1045678.n5.nabble.com/VtK-7-python3-4-build-error" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/VtK-7-python3-4-build-<wbr>error</a><br>
>> -td5735728.html ; but that doesn't help me since my python path are<br>
>> correctly set.<br>
>><br>
>> The building config is :<br>
>> Windows 10 x64<br>
>> Visual Studio 2017<br>
>> Python 3.6.1 (installed from <a href="http://python.org" rel="noreferrer" target="_blank">python.org</a> exe)<br>
>> VTK 7.1.1 with :<br>
>> -PYTHON_DEBUG_LIBRARY C:/Program Files/Python_3.6.1/libs/<wbr>python36_d.lib<br>
>> -PYTHON_EXECUTABLE C:/Program Files/Python_3.6.1/python.exe<br>
>> -PYTHON_INCLUDE_DIR C:/Program Files/Python_3.6.1/include<br>
>> -PYTHON_LIBRARY C:/Program Files/Python_3.6.1/libs/<wbr>python36.lib<br>
>> (-Static libraries)<br>
>><br>
>> Anyone have already encountered such problems and solved it ?<br>
>><br>
>> Thanks in advance.<br>
>><br>
>> Tim<br>
>><br>
><br>
</div></div></blockquote></div><br></div>