Search code examples
c++hdf5flann

HDF5 library segfault (mismatching headers)


I installed the flann and libhdf5-serial-dev c++ library on ubuntu. After that, I compiled the flann_example.cpp file without problems. However, when I launched the executable I got the following error message :

Warning! HDF5 library version mismatched error The HDF5 header files used to compile this application do not match the version used by the HDF5 library to which this application is linked. Data corruption or segmentation faults may occur if the application continues. This can happen when an application was compiled by one version of HDF5 but linked with a different version of static or shared HDF5 library. You should recompile the application or check your shared library related settings such as 'LD_LIBRARY_PATH'. You can, at your own risk, disable this warning by setting the environment variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'. Setting it to 2 or higher will suppress the warning messages totally. Headers are 1.8.16, library is 1.8.7 Bye... Abandon (core dumped)

I used the following expression to suppress this warning :

 cmake -HDF5_DISABLE_VERSION_CHECK=1 -H. -Bbuild

But I still have this message. I looked for the optional flag HDF5_DISABLE_VERSION_CHECK with ccmake to check if it's setting to 1. But I couldn't see this flag. Someone could help me to solve this issue ?


Solution

  • You can, at your own risk, disable this warning by setting the environment variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.

    HDF5_DISABLE_VERSION_CHECK is an environment variable, not a compiler #define or CMake variable. Set it within your shell:

    export HDF5_DISABLE_VERSION_CHECK=1
    path/to/flann_example
    

    or

    HDF5_DISABLE_VERSION_CHECK=1 path/to/flann_example
    

    However, you're probably much better off fixing the root problem (the library mismatch). On Ubuntu, if you always install the Ubuntu-packaged versions of libraries (via apt, aptitude, Synaptic...) instead of installing libraries yourself, this should ensure that all library versions are compatible.