BTW petscviewer.h included by petscsys.h always includes hdf5.h (when PETSc installed with hdf5) because of hsize_t and hid_t are in the public API of PETSc viewer for hdf5.
We can either have separate petscviewerhdf5.h or we could include just H5public.h and H5Ipublic.h in petscviewer.h to get these beasties defined.
I vote for the first but am fine with the second.