I'm preparing PETSc/SLEPc in Debian. 3.7 versions are in the Debian experimental repository. PETSC 3.7.2, SLEPc 3.7.1 and petsc4py 3.7.0 have all built successfully. slepc4py 3.6.0 also built successfully with the 3.6 versions.
But slepc4py 3.7.0 fails to build with the following error:
creating build/temp.linux-x86_64-2.7/src
mpicxx -pthread -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -DPETSC_DIR=/usr/lib/petscdir/3.7 -DSLEPC_DIR=/usr/lib/slepcdir/3.7 -I/usr/lib/slepcdir/3.7/include -I/usr/lib/openmpi/include/openmpi -I/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent/include -I/usr/lib/openmpi/include/openmpi/opal/mca/event/libevent2021/libevent -I/usr/lib/openmpi/include -I/usr/include/scotch -I/usr/include/suitesparse -I/usr/include -I/usr/lib/petscdir/3.7.2/x86_64-linux-gnu-real/include -Isrc/include -I/usr/lib/python2.7/dist-packages/petsc4py/include -I/usr/include/python2.7 -c src/SLEPc.c -o build/temp.linux-x86_64-2.7/src/SLEPc.o
In file included from src/SLEPc.c:3:0:
src/slepc4py.SLEPc.c: In function ‘PyObject* __pyx_pf_8slepc4py_5SLEPc_2BV_34setMatrix(PySlepcBVObject*, PyPetscMatObject*, int)’:
src/slepc4py.SLEPc.c:12054:13: error: invalid conversion from ‘void*’ to ‘Mat {aka _p_Mat*}’ [-fpermissive]
__pyx_v_m = __pyx_t_1;
^
Has anyone else bumped into this build error? What might be causing it? Should the assignment be done with an explicit cast?
Using python 2.7.12. Compiler version g++ 5.4.0, invoked as mpicxx managed by libopenmpi-dev 1.10.3-3.
More complete log (building via dpkg-buildpackage) is attached.
Apply patch from commit a93f720 (https://bitbucket.org/slepc/slepc4py/commits/a93f720cf03e48aa9bb84283d7b2f5423d0b6cfa/raw/), but then you need to regenerate the C wrappers with Cython (python setup.py build_src --force), then generate a patch for
src/slepc4py.SLEPc.c
. Add this patch to deb build recipe, and you should be done.Alternatively, you could just patch the Cython-generated C wrapper code (
src/slepc4py.SLEPc.c
) and add explicit casts in the offending places.PS: Any reason you are building with C++? I would recommend against it. Using plain C with C99 complex numbers should be enough.