HDF5Interface.cpp incompatible with recent HDF5 API

Issue #1110 resolved
quentin_ayoul-guilmard created an issue

My build of DOLFIN 2019.1.0.post0 failed on dolfin/CMakeFiles/dolfin.dir/io/HDF5Interface.cpp.o with the following message

    dolfin/io/HDF5Interface.cpp:286:30: error: too few arguments to function `herr_t H5Oget_info_by_name3(hid_t, const char*, H5O_info2_t*, unsigned int, hid_t)'
      286 |                       lapl_id);
          |                              ^
    In file included from /usr/include/H5Apublic.h:22,
                     from /usr/include/hdf5.h:23,
                     from dolfin/io/HDF5Interface.h:32,
                     from dolfin/io/HDF5Attribute.h:30,
                     from dolfin/io/HDF5File.h:32,
                     from dolfin/io/HDF5Interface.cpp:26:
    /usr/include/H5Opublic.h:188:15: note: declared here
      188 | H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo,
          |               ^~~~~~~~~~~~~~~~~~~~
    make[2]: *** [dolfin/CMakeFiles/dolfin.dir/build.make:1344: dolfin/CMakeFiles/dolfin.dir/io/HDF5Interface.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:1731: dolfin/CMakeFiles/dolfin.dir/all] Error 2
    make: *** [Makefile:161: all] Error 2

I traced this to an issue of compatibility with the API of HDF5.
I am using the version 1.12.0 of HDF5. The following fixed the build (I have not tested HDF5):

    --- dolfin/io/HDF5Interface.cpp 
    +++ dolfin/io/HDF5Interface.cpp 
    @@ -281,8 +281,8 @@
         return false;
       }

    -  H5O_info_t object_info;
    -  H5Oget_info_by_name(hdf5_file_handle, group_name.c_str(), &object_info,
    +  H5O_info1_t object_info;
    +  H5Oget_info_by_name1(hdf5_file_handle, group_name.c_str(), &object_info,
                           lapl_id);

       // Close link access properties

This may work for earlier versions of HDF5; I don’t know when H5O_info1_t and H5Oget_info_by_name1 were introduced.
If it doesn’t, then the documentation of DOLFIN should state which versions of HDF5 are compatible. HDF5 can apparently be built with anterior API compatibility (see my first link), but I have not looked into it.

Comments (2)

  1. Log in to comment