demo/wrap-swig needs PETSc CFLAGS (hdf include path)

Issue #130 resolved
Drew Parsons created an issue

Something seems to have changed in PETSc 3.11.3 (unless I messed up a patch). Running demo tests on Debian gives this failure in wrap-swig:

$ cd demo/wrap-swig/
$ make PETSC_DIR=${PETSC_DIR} PYTHON=python3 F2PY=f2py3
CC=mpicc F90=mpif90 LDSHARED='mpicc -Wl,-z,relro -fPIC  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC  -shared' \
python3 setup.py -q build_ext --inplace
In file included from /usr/lib/petsc/include/petscvec.h:9,
                 from /usr/lib/petsc/include/petscmat.h:6,
                 from /usr/lib/petsc/include/petscdm.h:6,
                 from /usr/lib/petsc/include/petscdmda.h:4,
                 from /usr/lib/petsc/include/petsc.h:13,
                 from ./Bratu3D.h:4,
                 from ./Bratu3D.c:20:
/usr/lib/petsc/include/petscis.h:317:10: fatal error: H5Ipublic.h: No such file or directory
 #include <H5Ipublic.h>
          ^~~~~~~~~~~~~
compilation terminated.
In file included from /usr/lib/petsc/include/petscvec.h:9,
                 from /usr/lib/petsc/include/petscmat.h:6,
                 from /usr/lib/petsc/include/petscdm.h:6,
                 from /usr/lib/petsc/include/petscdmda.h:4,
                 from /usr/lib/petsc/include/petsc.h:13,
                 from /usr/lib/python3/dist-packages/petsc4py/include/petsc4py/petsc4py.h:8,
                 from ./Bratu3D_wrap.c:3085:
/usr/lib/petsc/include/petscis.h:317:10: fatal error: H5Ipublic.h: No such file or directory
 #include <H5Ipublic.h>
          ^~~~~~~~~~~~~
compilation terminated.

The petsc4py code hasn’t changed so this must be a change in the PETSc headers.

The makefile for wrap-swig doesn’t specially add path flags. The compilation failure can be fixed by replacing

CC=${CC} F90=${FC} LDSHARED='${CLINKER} -shared'

with

CC=${CC} F90=${FC} CFLAGS='${PETSC_CCPPFLAGS} ${CFLAGS}' LDSHARED='${CLINKER} -shared'

(probably PETSC_CCPPFLAGS is more appropriate, though the more targeted HDF5_INCLUDE would also enable compilation)

Comments (11)

  1. Lisandro Dalcin

    @Matthew Knepley Any chance your changes to petsc/maint screw things up? Do we really need to include HDF5 headers in public PETSc headers other than petscviewerhdf5.h?

  2. Drew Parsons reporter

    It does seem to be a regression in PETSc 3.11.3. I think I’ve pinned it down. tldr; nothing to see here, it’s already fixed in PETSc master.

    The #include <H5Ipublic.h> in petscis.h was new. It had the consequence that HDF5 include paths would need to be added when compiling, even if the PETSc client program doesn’t use HDF5 itself.

    It’s been addressed by commit 6a0bd7522af7eb76a79ca5f1af77fc9a30e8cdb2, which refactors the HDF5-specific code into a private header so only active when specifically needed. With that patch in place, nothing specific needs to be done, unless you do need petsc4py to work with PETSC 3.11.3.

  3. Lisandro Dalcin

    @BarryFSmith @Jed Brown Despite this seems to be fixed in petsc/master, though in not the best way, PetscViewerHDF5Load() simply do not below to IS, it should go to petscviewerhdf5.h.

    IMHO this is a nasty regression in petsc/maint. We should put all the HDF5 stuff in petscviewerhdf5.h. What should we do now? Fix maint and go to the hassle of handling the merge conflicts? Or just fix master?

  4. BarryFSmith
    • changed status to open

    Hmm, not sure why Lisandro closed this. It would be good to have it work in PETSc 3.11 plus the fix in master is ugly

  5. Log in to comment