Dolfin python interface cannot find -lhdf5-shared

Issue #1081 new
Evan Cummings created an issue

Hi there,

I am in the process of installing the latest “master” branch (ec57db53f2b13f1768214829e8b4f80fc32205cf) which seems to compile and install fine, and reports the message:

-- Found HDF5: hdf5-shared (found version "1.11.6") found components: C

When I try to install the python interface, I get the error:

[100%] Linking CXX shared library ../lib.linux-x86_64-3.7-pydebug/dolfin/cpp.cpython-37dm-x86_64-linux-gnu.so
/usr/bin/ld: cannot find -lhdf5-shared

I have HDF5 installed in a non-standard location, and the pkgconfig file dolfin/lib/pkgconfig/dolfin.pc contains the correct hdf5 directory, but -lhdf5-shared is not listed in the Libs: section.

I am no CMake expert, but if I add the line find_package(HDF5 COMPONENTS C) before the pybind_add_module command and target_link_libraries(cpp PUBLIC ${HDF5_C_LIBRARIES}) afterwards, hdf5 is linked properly and I can import the package.

Thanks,

Evan

Comments (1)

  1. Evan Cummings reporter

    UPDATE:

    Running cmake with the flag -D DOLFIN_ENABLE_HDF5=true after completely removing my build of HDF5 and installing libhdf5-mpich-dev as suggested by the dev-env dockerfile will produce the error:

      Environment variable HDF5_ROOT is set to:
    
        /home/pf4d/local/hdf5-1.10.2
    
      For compatibility, CMake is ignoring the variable.
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS C) (found version "")
    

    if the environment variable $HDF5_DIR is set. Removing this environment variable and running cmake again produces:

    -- HDF5: Using hdf5 compiler wrapper to determine C configuration
    -- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.4") found components:  C
    

    and dolfin compiles correctly.

    I am not sure exactly what the deal is with HDF5, perhaps this is an issue for their working group, but I believe it would be preferable to not check for environment variables and instead rely on the user supplying -DHDF5_ROOT flags to cmake.

    -E

  2. Log in to comment