[vtkusers] Building VTK 7.1.1 with Python wrapping fail

David Gobbi david.gobbi at gmail.com
Thu May 4 13:43:55 EDT 2017


Hi Timothee,

I checked the logs, it looks like that change was done around one year ago,
but wasn't in the 7.1.1 release.

It looks like it links to the correct libraries, are you still seeing the
missing symbol errors?

 - David


On Wed, May 3, 2017 at 1:20 PM, Timothee Evain <tevain at telecom-paristech.fr>
wrote:

> Hi!
>
> That explains why the full are in both profile, thanks for the
> clarification!
>
> One strange thing about the CMakeLists.txt: the one I got downloading the
> 7.1.1 archive on vtk.org does not contain this part before
> "target_link_libraries(vtkpython ${VTKPYTHON_LINK_LIBS})" (around line
> 246) :
>
> # Add the libPython.dylib file and link explicitly against it.
> # This is needed because this is a new python executable, which needs it's
> libraries.
> find_package(PythonLibs REQUIRED)
> list(APPEND VTKPYTHON_LINK_LIBS ${vtkPython_LIBRARIES})
>
> that is in contrast to the file in github. Nonetheless, after fixing it,
> the reporting is :
>
> vtkPython_LIBRARIES C:/Program Files/Python_3.6.1/libs/python36.lib
>
> VTKPYTHON_LINK_LIBS vtkWrappingPythonCore;
> vtkCommonCorePython;
> vtkCommonMathPython;
> vtkCommonMiscPython;
> vtkCommonSystemPython;
> vtkCommonTransformsPython;
> vtkCommonDataModelPython;
> vtkCommonColorPython;
> vtkCommonExecutionModelPython;
> vtkCommonComputationalGeometryPython;
> vtkFiltersCorePython;
> vtkFiltersGeneralPython;
> vtkImagingCorePython;
> vtkImagingFourierPython;
> vtkFiltersStatisticsPython;
> vtkFiltersExtractionPython;
> vtkInfovisCorePython;
> vtkFiltersGeometryPython;
> vtkFiltersSourcesPython;
> vtkRenderingCorePython;
> vtkRenderingFreeTypePython;
> vtkRenderingContext2DPython;
> vtkChartsCorePython;
> vtkIOImagePython;
> vtkIOCorePython;
> vtkIOSQLPython;
> vtkImagingStatisticsPython;
> vtkInteractionStylePython;
> vtkRenderingImagePython;
> vtkRenderingOpenGL2Python;
> vtkDICOMPython;
> vtkIOLegacyPython;
> vtkIOXMLParserPython;
> vtkDomainsChemistryPython;
> vtkDomainsChemistryOpenGL2Python;
> vtkIOXMLPython;
> vtkParallelCorePython;
> vtkFiltersAMRPython;
> vtkFiltersFlowPathsPython;
> vtkFiltersGenericPython;
> vtkImagingSourcesPython;
> vtkFiltersHybridPython;
> vtkFiltersHyperTreePython;
> vtkImagingGeneralPython;
> vtkFiltersImagingPython;
> vtkFiltersModelingPython;
> vtkFiltersParallelPython;
> vtkFiltersParallelImagingPython;
> vtkFiltersPointsPython;vtkFiltersProgrammablePython;
> vtkFiltersPythonPython;vtkFiltersSMPPython;vtkFiltersSelectionPython;
> vtkFiltersTexturePython;vtkFiltersVerdictPython;vtkImagingHybridPython;
> vtkInfovisLayoutPython;vtkImagingColorPython;vtkRenderingAnnotationPython;
> vtkRenderingVolumePython;vtkInteractionWidgetsPython;vtkViewsCorePython;
> vtkGeovisCorePython;vtkIOAMRPython;vtkIOEnSightPython;vtkIOExodusPython;
> vtkRenderingGL2PSOpenGL2Python;vtkIOExportPython;vtkIOGeometryPython;
> vtkIOImportPython;vtkIOInfovisPython;vtkIOLSDynaPython;vtkIOMINCPython;
> vtkIOMoviePython;vtkIONetCDFPython;vtkIOPLYPython;vtkIOParallelPython;
> vtkIOParallelXMLPython;vtkIOTecplotTablePython;vtkIOVideoPython;
> vtkImagingMathPython;vtkImagingMorphologicalPython;
> vtkImagingOpenGL2Python;vtkImagingStencilPython;vtkInteractionImagePython;
> vtkPythonInterpreterPython;vtkRenderingContextOpenGL2Pyth
> on;vtkRenderingLODPython;vtkRenderingLabelPython;
> vtkRenderingMatplotlibPython;vtkRenderingVolumeOpenGL2Pytho
> n;vtkViewsContext2DPython;vtkViewsInfovisPython;C:/Program
> Files/Python_3.6.1/libs/python36.lib
>
>
> ----- 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é: Mercredi 3 Mai 2017 02:08:05
> Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail
>
> Hi Timothee,
>
> 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.
>
> 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.
>
> As for the link error, it probably has to do with these lines in
> Wrapping/Python/CMakeLists.txt:
>
>   list(APPEND VTKPYTHON_LINK_LIBS ${vtkPython_LIBRARIES})
>   target_link_libraries(vtkpython ${VTKPYTHON_LINK_LIBS})
>
> Can you add the following immediately below these lines, and tell me what
> is printed?
>
>   message(STATUS "vtkPython_LIBRARIES ${vtkPython_LIBRARIES}")
>   message(STATUS "VTKPYTHON_LINK_LIBS ${VTKPYTHON_LINK_LIBS}")
>
> Regards,
>  - David
>
>
>
> On Tue, May 2, 2017 at 1:38 PM, Timothee Evain <
> tevain at telecom-paristech.fr>
> wrote:
>
> > 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
> > >>
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170504/8057f13d/attachment.html>


More information about the vtkusers mailing list