Cannot build caffe with anaconda. Error: while loading shared libraries: libhdf5_hl.so.10

3,301 views
Skip to first unread message

Rupesh Singh

unread,
Jul 12, 2015, 5:20:56 AM7/12/15
to caffe...@googlegroups.com
My Makefile.config is like this:

    # BLAS choice:
    # atlas for ATLAS (default)
    # mkl for MKL
    # open for OpenBlas
    BLAS := atlas
    # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
    # Leave commented to accept the defaults for your choice of BLAS
    # (which should work)!
    BLAS_INCLUDE := /usr/include
    BLAS_LIB := /usr/lib64/atlas

    ANACONDA_HOME := $(HOME)/aconda
    PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
        $(ANACONDA_HOME)/include/python2.7 \
        $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \

    # We need to be able to find libpythonX.X.so or .dylib.
    # PYTHON_LIB := /usr/lib
    PYTHON_LIB := $(ANACONDA_HOME)/lib

    # Homebrew installs numpy in a non standard path (keg only)
    # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
    # PYTHON_LIB += $(shell brew --prefix numpy)/lib

    # Uncomment to support layers written in Python (will link against Python libs)
    # WITH_PYTHON_LAYER := 1

    # Whatever else you find you need goes here.
    INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
    LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib


I have successfully compiled caffe with pycaffe. I also ran make test successfully. But make runtest gives me the following error:
    [student@localhost caffe]$ make runtest
    .build_release/tools/caffe
    .build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.10: cannot open shared object file: No such file or directory
    make: *** [runtest] Error 127


I believe hdf5 is installed with anaconda and I have given the path to lib in anaconda( Please see the last line of config i have placed here) ie.
    LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib.


Before this I has installed hdf5 1.8.12 with yum and libhdf5_hl.so.8 was present in /usr/lib64/ , but not libhdf5_hl.so.10 which is not found in error message.
I created a softlink like this
$sudo ln -s libhdf5_hl.so.8 libhdf5_hl.so.10
$sudo ldconfig

Doing this it found the softlink libhdf5_hl.so.10 in /usr/lib64/ but gave a hdf5 version mismatch error while running test.

My question is that i have not given '/usr/lib64/' this path anywhere in config, how the make process goes to look there for that lib but doesnot look at LIBRARY_DIR provided. And all required hdf5 lib are present in LIBRARY_DIR.

Rupesh Singh

unread,
Jul 12, 2015, 6:08:56 AM7/12/15
to caffe...@googlegroups.com
Hi all, I solved the issue. I also have to set path to variable LD_LIBRARY_PATH environment variable to lib directory of anaconda.
My anaconda lib directory is '/home/student/aconda/lib'
i did like this:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/student/aconda/lib

Brook Wong

unread,
Apr 2, 2016, 5:16:22 AM4/2/16
to Caffe Users
But if I add the path into the environment variable, it turns out another problem that I can't open vi from terminal.

Auto Generated Inline Image 1
Reply all
Reply to author
Forward
0 new messages