Joao Ponte
Joao Ponte

Reputation: 170

VTK 7.1.0 + Python 3.5.2 make error

I had an error during the built of VTK 7.1.0 using python 3.5.2 on Ubuntu 16.04. I searched several times and I didn't figured out how to resolve it :/

I have found one conversation about it, but they didn't found a solution.

Some time ago, I built the VTK using the same python 3.5.2 and it has worked, but somehow it doesn't work now..

One small slice of this error is:

In file included from /home/joaoponte/Downloads/VTK-git/vtk/Wrapping/Python/vtkPythonAppInit.cxx:29:0: /home/joaoponte/Downloads/VTK-git/vtk-build/Wrapping/Python/vtkpythonmodules.h: In function ‘void vtkpythonmodulesPythonLoadAllPythonModules()’:

/home/joaoponte/Downloads/VTK-git/vtk-build/Wrapping/Python/vtkpythonmodules.h:125:68: error: invalid conversion from ‘void ()()’ to ‘PyObject ()() {aka _object (*)()}’ [-fpermissive]

PyImport_AppendInittab(namevtkCommonCore, initvtkCommonCorePython); ^ In file included from /usr/include/python3.5m/Python.h:120:0, from /home/joaoponte/Downloads/VTK-git/vtk/Utilities/Python/vtkPython.h:80, from /home/joaoponte/Downloads/VTK-git/vtk/Wrapping/Python/vtkPythonAppInit.cxx:18: /usr/include/python3.5m/import.h:109:17: note: initializing argument 2 of ‘int PyImport_AppendInittab(const char*, PyObject* (*)())’

It repeats for all modules listed in the vtkpythonmodules.h file.

In the vtkpythonmodules.h I found this (and others):

extern void initvtkCommonCorePython();

and this:

static char namevtkCommonCore[] = "vtkCommonCorePython";
PyImport_AppendInittab(namevtkCommonCore, initvtkCommonCorePython);

And in the Python.h, I found this:

PyAPI_FUNC(int) PyImport_AppendInittab(
    const char *name,           /* ASCII encoded string */
    PyObject* (*initfunc)(void) 
    );

I'm using the latest VTK version downloaded from git and the default python3 from Ubuntu 16.04 and I used the ccmake to configure.

the python executable, include_dir and library was using the python3.5m but I tried python3.5 as well and failed too :(

Does anyone have any idea to resolve this? Is it a misconfiguration of python3 or whatever else in my system?

EDIT: I've found that in the import.h file from python 2.7, the PyImport_AppendInittab seems to be the "right" (?) ones...

PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc (void));

Was that an ccmake error during the configuration process? I choose python3.5, but the vtkpythonmodules.h was made using extern void.

Upvotes: 0

Views: 429

Answers (1)

TomNorway
TomNorway

Reputation: 3162

I'm not really familiar with installing VTK on Ubuntu, but we just successfully installed VTK using conda. You might have more luck with that: conda install -c conda-forge vtk=7.1.0

Upvotes: 1

Related Questions