<div dir="ltr">Hi Tomothee,<div><br></div><div>I think I made a mistake in the first fix that I suggested. The correct name of the init methods is PyInit_vtkXXPython(), so the code in vtkPythonWrapping.cmake should be this:</div><div><div><br></div><div> set (EXTERN_DEFINES "${EXTERN_DEFINES}\n extern PyObject *PyInit_${module}Python();")</div></div><div><br></div><div>Hopefully that will work.</div><div><br></div><div> - David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 4, 2017 at 11:49 AM, 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>
yes, the missing symbol errors are still there unfortunately, even with the CMakeLists fix.<br>
<span class=""><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>
</span>Envoyé: Jeudi 4 Mai 2017 19:43:55<br>
<span class="im HOEnZb">Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail<br>
<br>
Hi Timothee,<br>
<br>
</span><div class="HOEnZb"><div class="h5">I checked the logs, it looks like that change was done around one year ago,<br>
but wasn't in the 7.1.1 release.<br>
<br>
It looks like it links to the correct libraries, are you still seeing the<br>
missing symbol errors?<br>
<br>
- David<br>
<br>
<br>
On Wed, May 3, 2017 at 1:20 PM, Timothee Evain <<a href="mailto:tevain@telecom-paristech.fr">tevain@telecom-paristech.fr</a>><br>
wrote:<br>
<br>
> Hi!<br>
><br>
> That explains why the full are in both profile, thanks for the<br>
> clarification!<br>
><br>
> One strange thing about the CMakeLists.txt: the one I got downloading the<br>
> 7.1.1 archive on <a href="http://vtk.org" rel="noreferrer" target="_blank">vtk.org</a> does not contain this part before<br>
> "target_link_libraries(<wbr>vtkpython ${VTKPYTHON_LINK_LIBS})" (around line<br>
> 246) :<br>
><br>
> # Add the libPython.dylib file and link explicitly against it.<br>
> # This is needed because this is a new python executable, which needs it's<br>
> libraries.<br>
> find_package(PythonLibs REQUIRED)<br>
> list(APPEND VTKPYTHON_LINK_LIBS ${vtkPython_LIBRARIES})<br>
><br>
> that is in contrast to the file in github. Nonetheless, after fixing it,<br>
> the reporting is :<br>
><br>
> vtkPython_LIBRARIES C:/Program Files/Python_3.6.1/libs/<wbr>python36.lib<br>
><br>
> VTKPYTHON_LINK_LIBS vtkWrappingPythonCore;<br>
> vtkCommonCorePython;<br>
> vtkCommonMathPython;<br>
> vtkCommonMiscPython;<br>
> vtkCommonSystemPython;<br>
> vtkCommonTransformsPython;<br>
> vtkCommonDataModelPython;<br>
> vtkCommonColorPython;<br>
> vtkCommonExecutionModelPython;<br>
> vtkCommonComputationalGeometry<wbr>Python;<br>
> vtkFiltersCorePython;<br>
> vtkFiltersGeneralPython;<br>
> vtkImagingCorePython;<br>
> vtkImagingFourierPython;<br>
> vtkFiltersStatisticsPython;<br>
> vtkFiltersExtractionPython;<br>
> vtkInfovisCorePython;<br>
> vtkFiltersGeometryPython;<br>
> vtkFiltersSourcesPython;<br>
> vtkRenderingCorePython;<br>
> vtkRenderingFreeTypePython;<br>
> vtkRenderingContext2DPython;<br>
> vtkChartsCorePython;<br>
> vtkIOImagePython;<br>
> vtkIOCorePython;<br>
> vtkIOSQLPython;<br>
> vtkImagingStatisticsPython;<br>
> vtkInteractionStylePython;<br>
> vtkRenderingImagePython;<br>
> vtkRenderingOpenGL2Python;<br>
> vtkDICOMPython;<br>
> vtkIOLegacyPython;<br>
> vtkIOXMLParserPython;<br>
> vtkDomainsChemistryPython;<br>
> vtkDomainsChemistryOpenGL2Pyth<wbr>on;<br>
> vtkIOXMLPython;<br>
> vtkParallelCorePython;<br>
> vtkFiltersAMRPython;<br>
> vtkFiltersFlowPathsPython;<br>
> vtkFiltersGenericPython;<br>
> vtkImagingSourcesPython;<br>
> vtkFiltersHybridPython;<br>
> vtkFiltersHyperTreePython;<br>
> vtkImagingGeneralPython;<br>
> vtkFiltersImagingPython;<br>
> vtkFiltersModelingPython;<br>
> vtkFiltersParallelPython;<br>
> vtkFiltersParallelImagingPytho<wbr>n;<br>
> vtkFiltersPointsPython;<wbr>vtkFiltersProgrammablePython;<br>
> vtkFiltersPythonPython;<wbr>vtkFiltersSMPPython;<wbr>vtkFiltersSelectionPython;<br>
> vtkFiltersTexturePython;<wbr>vtkFiltersVerdictPython;<wbr>vtkImagingHybridPython;<br>
> vtkInfovisLayoutPython;<wbr>vtkImagingColorPython;<wbr>vtkRenderingAnnotationPython;<br>
> vtkRenderingVolumePython;<wbr>vtkInteractionWidgetsPython;<wbr>vtkViewsCorePython;<br>
> vtkGeovisCorePython;<wbr>vtkIOAMRPython;<wbr>vtkIOEnSightPython;<wbr>vtkIOExodusPython;<br>
> vtkRenderingGL2PSOpenGL2Python<wbr>;vtkIOExportPython;<wbr>vtkIOGeometryPython;<br>
> vtkIOImportPython;<wbr>vtkIOInfovisPython;<wbr>vtkIOLSDynaPython;<wbr>vtkIOMINCPython;<br>
> vtkIOMoviePython;<wbr>vtkIONetCDFPython;<wbr>vtkIOPLYPython;<wbr>vtkIOParallelPython;<br>
> vtkIOParallelXMLPython;<wbr>vtkIOTecplotTablePython;<wbr>vtkIOVideoPython;<br>
> vtkImagingMathPython;<wbr>vtkImagingMorphologicalPython;<br>
> vtkImagingOpenGL2Python;<wbr>vtkImagingStencilPython;<wbr>vtkInteractionImagePython;<br>
> vtkPythonInterpreterPython;<wbr>vtkRenderingContextOpenGL2Pyth<br>
> on;vtkRenderingLODPython;<wbr>vtkRenderingLabelPython;<br>
> vtkRenderingMatplotlibPython;<wbr>vtkRenderingVolumeOpenGL2Pytho<br>
> n;vtkViewsContext2DPython;<wbr>vtkViewsInfovisPython;C:/<wbr>Program<br>
> Files/Python_3.6.1/libs/<wbr>python36.lib<br>
><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" <<br>
> <a href="mailto:utkarsh.ayachit@kitware.com">utkarsh.ayachit@kitware.com</a>><br>
> Envoyé: Mercredi 3 Mai 2017 02:08:05<br>
> Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail<br>
><br>
> Hi Timothee,<br>
><br>
> The "D" on the the vtk*PythonD does not mean "Debug". Each build (whether<br>
> release or debug) will have a full set of vtk*PythonD libraries and<br>
> vtk*Python modules. Both are needed for the VTK build.<br>
><br>
> My system doesn't have a python_d debug library (I'm OS X), but it is<br>
> probably unrelated to the link error, and it is totally unrelated to the<br>
> PythonD libraries.<br>
><br>
> As for the link error, it probably has to do with these lines in<br>
> Wrapping/Python/CMakeLists.<wbr>txt:<br>
><br>
> list(APPEND VTKPYTHON_LINK_LIBS ${vtkPython_LIBRARIES})<br>
> target_link_libraries(<wbr>vtkpython ${VTKPYTHON_LINK_LIBS})<br>
><br>
> Can you add the following immediately below these lines, and tell me what<br>
> is printed?<br>
><br>
> message(STATUS "vtkPython_LIBRARIES ${vtkPython_LIBRARIES}")<br>
> message(STATUS "VTKPYTHON_LINK_LIBS ${VTKPYTHON_LINK_LIBS}")<br>
><br>
> Regards,<br>
> - David<br>
><br>
><br>
><br>
> On Tue, May 2, 2017 at 1:38 PM, Timothee Evain <<br>
> <a href="mailto:tevain@telecom-paristech.fr">tevain@telecom-paristech.fr</a>><br>
> wrote:<br>
><br>
> > Hello David,<br>
> ><br>
> > Some follow-up:<br>
> ><br>
> > After vtkPythonWrapping.cmake modification, the first set of error is<br>
> gone.<br>
> > But then, linking fail for this project with:<br>
> > [...]<br>
> > 1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol<br>
> > initvtkCommonCorePython referenced in function "void __cdecl<br>
> > vtkpythonmodulesPythonLoadAllP<wbr>ythonModules(void)" (?<br>
> > vtkpythonmodulesPythonLoadAllP<wbr>ythonModules@@YAXXZ)<br>
> > 1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol<br>
> > initvtkCommonMathPython referenced in function "void __cdecl<br>
> > vtkpythonmodulesPythonLoadAllP<wbr>ythonModules(void)" (?<br>
> > vtkpythonmodulesPythonLoadAllP<wbr>ythonModules@@YAXXZ)<br>
> > 1>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol<br>
> > initvtkCommonMiscPython referenced in function "void __cdecl<br>
> > vtkpythonmodulesPythonLoadAllP<wbr>ythonModules(void)" (?<br>
> > 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<br>
> set<br>
> > for release profile but also on debug (rather than<br>
> [...]Python_3.6.1\libs\<wbr>python36_d.lib<br>
> > ?) by cmake.<br>
> > Then, for both profiles are linked all the vtk*Python and all the<br>
> > vtk*PythonD libs, which seems unusual, as I was expecting vtk*Python libs<br>
> > in release and vtk*PythonD libs in debug.<br>
> > I'm not sure if this is an expected configuration, so I have not found<br>
> the<br>
> > source of error.<br>
> ><br>
> > Don't hesitate to tell me if you need additionnal information!<br>
> ><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" <<br>
> > <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>
> > 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<br>
> 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>><br>
> 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.<br>
> I'm<br>
> > > not sure how difficult this is to fix. It might be as simple as<br>
> 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<br>
> > studio<br>
> > >> 2017 on Win10. Everything goes fine until the end of the build, where<br>
> 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:<br>
> > 'int<br>
> > >> PyImport_AppendInittab(const char *,PyObject *(__cdecl *)(void))':<br>
> > cannot<br>
> > >> convert argument 2 from 'void (__cdecl *)(void)' to 'PyObject<br>
> *(__cdecl<br>
> > >> *)(void)'<br>
> > >> ...\VTK_7.1.1\Wrapping\Python\<wbr>vtkpythonmodules.h(126): note: None of<br>
> > 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:<br>
> > 'int<br>
> > >> PyImport_AppendInittab(const char *,PyObject *(__cdecl *)(void))':<br>
> > cannot<br>
> > >> convert argument 2 from 'void (__cdecl *)(void)' to 'PyObject<br>
> *(__cdecl<br>
> > >> *)(void)'<br>
> > >> ...\VTK_7.1.1\Wrapping\Python\<wbr>vtkpythonmodules.h(129): note: None of<br>
> > 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/<br>
> 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>
> ><br>
><br>
</div></div></blockquote></div><br></div>