[vtkusers] Building VTK 7.1.1 with Python wrapping fail

David Gobbi david.gobbi at gmail.com
Fri May 5 13:56:43 EDT 2017


Hi Timothee,

I'm glad that you got it working, I've submitted a bug fix for
vtkPythonWrapping (https://gitlab.kitware.com/vtk/vtk/merge_requests/2786).

Hopefully someone will pick up the PYTHON_DEBUG_LIBRARY issue and get it
fixed.

 - David


On Fri, May 5, 2017 at 2:00 AM, Timothee Evain <tevain at telecom-paristech.fr>
wrote:

> Hi,
>
> My bad, I didn't notice it.
> But good news, it works!
> So to resume, I had to change the vtkPythonWrapping.cmake like this :
>
> if (NOT BUILD_SHARED_LIBS)
>     # fill in the init functions only when BUILD_SHARED_LIBS is OFF.
>     foreach (module ${ARGN})
>       set (EXTERN_DEFINES "${EXTERN_DEFINES}\n  extern PyObject
> *PyInit_${module}Python();")
>       set (INIT_CALLS "${INIT_CALLS}\n
>   static char name${module}[] = \"${module}Python\";
>   PyImport_AppendInittab(name${module}, PyInit_${module}Python);")
>     endforeach()
>   endif()
>
> Another thing is that cmake detected a python debug library on my system
> (PYTHON_DEBUG_LIBRARY variable), but there is a mistake in the lib list to
> link for debug profile, it's the release python lib which is set. I just
> had to change that in the linking to get it work for both profile. I made
> it through manual modification on my VS project, I guess this can be
> achieved through CMake, but I don't know where.
>
> Anyhow, I would like to thank you for all the help and the time you put on
> my problem, that was really appreciated !
>
> 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é: Vendredi 5 Mai 2017 00:27:51
> Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail
>
> There needs to be an underscore after PyInit (e.g.
> PyInit_vtkCommonMathPython).
>
> On Thu, May 4, 2017 at 4:23 PM, Timothee Evain <
> tevain at telecom-paristech.fr>
> wrote:
>
> > Hi David,
> >
> > With you suggestion, there are errors in pythonmodules.h (undeclared
> > identifiers). The names of modules don't correspond anymore with the ones
> > in the vtkpythonmodulesPythonLoadAllPythonModules() function.
> >
> > So I changed also this line in the vtkPythonWrapping.cmake (3 lines after
> > your fix):
> >
> > PyImport_AppendInittab(name${module}, init${module}Python);")
> > into
> > PyImport_AppendInittab(name${module}, PyInit${module}Python);")
> >
> > But then, I get the same linking errors as usual :
> > [...]
> > 290>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol
> > PyInitvtkCommonMathPython referenced in function "void __cdecl
> > vtkpythonmodulesPythonLoadAllPythonModules(void)" (?
> > vtkpythonmodulesPythonLoadAllPythonModules@@YAXXZ)
> > 290>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol
> > PyInitvtkCommonMiscPython referenced in function "void __cdecl
> > vtkpythonmodulesPythonLoadAllPythonModules(void)" (?
> > vtkpythonmodulesPythonLoadAllPythonModules@@YAXXZ)
> > 290>vtkPythonAppInit.obj : error LNK2019: unresolved external symbol
> > PyInitvtkCommonSystemPython referenced in function "void __cdecl
> > vtkpythonmodulesPythonLoadAllPythonModules(void)" (?
> > vtkpythonmodulesPythonLoadAllPythonModules@@YAXXZ)
> > [...]
> >
> > 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é: Jeudi 4 Mai 2017 22:30:20
> > Objet: Re: [vtkusers] Building VTK 7.1.1 with Python wrapping fail
> >
> > Hi Tomothee,
> >
> > 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:
> >
> >       set (EXTERN_DEFINES "${EXTERN_DEFINES}\n  extern PyObject
> > *PyInit_${module}Python();")
> >
> > Hopefully that will work.
> >
> >  - David
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170505/00a14584/attachment.html>


More information about the vtkusers mailing list