1

While compiling Caffe in Ubuntu 16.04, I got the following error:

LD -o .build_release/lib/libcaffe.so.1.0.0-rc3  
/usr/bin/ld: cannot find -lhdf5_hl  
/usr/bin/ld: cannot find -lhdf5  
collect2: error: ld returned 1 exit status  
Makefile:563: recipe for target '.build_release/lib/libcaffe.so.1.0.0-rc3' failed  
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc3] Error 1

Please suggest a way to successfully install caffe by removing this error?

karel
  • 110,292
  • 102
  • 269
  • 299
Aurora
  • 11
  • 2
  • Did you install the indicated [General dependencies](http://caffe.berkeleyvision.org/install_apt.html), in particular `libhdf5-serial-dev`? – steeldriver Jun 12 '16 at 13:22
  • All the dependencies are already installed!! – Aurora Jun 12 '16 at 14:47
  • It may be essentially the same issue as [here](http://askubuntu.com/questions/649401/octave-4-0-0-configuration-step-warnings-in-ubuntu-15-04-hdf5-jni-h-not-found) i.e. that Ubuntu's packaging has moved the hdf5 serial header files and libraries into subdirectories. Try adding an explicit link flag to your configuration e.g. `./configure LDFLAGS=-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/hdf5/serial` – steeldriver Jun 12 '16 at 14:58
  • I did that still while compilation,it gives the same error. – Aurora Jun 12 '16 at 15:10

1 Answers1

0

This worked for me, in 'Makefile.config' change line 94 and 95 to

LINE 94: INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial

LINE 95: LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib/x86_64-linux-gnu/hdf5/serial