caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Ubuntu 15.04 compilation failure due to "hdf5.h" instead of "hdf5/serial/hdf5.h" and similarly "hdf5_hl.h"

Open robertsdionne opened this issue 11 years ago • 20 comments

robertsdionne avatar Jul 04 '15 02:07 robertsdionne

Similarly, unable to find libhdf5 or libhdf5_hl, which are located at /usr/lib/x86_64-linux-gnu/hdf5/serial/

robertsdionne avatar Jul 04 '15 02:07 robertsdionne

diff --git a/Makefile.config.example b/Makefile.config.example
index a873502..33441b3 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -70,7 +70,7 @@ PYTHON_LIB := /usr/lib

 # Whatever else you find you need goes here.
 INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
-LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
+LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial

 # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
 # INCLUDE_DIRS += $(shell brew --prefix)/include
diff --git a/include/caffe/data_layers.hpp b/include/caffe/data_layers.hpp
index 3958cb7..2ccbaec 100644
--- a/include/caffe/data_layers.hpp
+++ b/include/caffe/data_layers.hpp
@@ -6,7 +6,7 @@
 #include <vector>

 #include "boost/scoped_ptr.hpp"
-#include "hdf5.h"
+#include "hdf5/serial/hdf5.h"

 #include "caffe/blob.hpp"
 #include "caffe/common.hpp"
diff --git a/include/caffe/util/io.hpp b/include/caffe/util/io.hpp
index 3a62c3c..f4363f0 100644
--- a/include/caffe/util/io.hpp
+++ b/include/caffe/util/io.hpp
@@ -5,8 +5,8 @@
 #include <string>

 #include "google/protobuf/message.h"
-#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h"

 #include "caffe/blob.hpp"
 #include "caffe/common.hpp"
diff --git a/src/caffe/layers/hdf5_data_layer.cpp b/src/caffe/layers/hdf5_data_layer.cpp
index 8a782f7..42890be 100644
--- a/src/caffe/layers/hdf5_data_layer.cpp
+++ b/src/caffe/layers/hdf5_data_layer.cpp
@@ -10,8 +10,8 @@ TODO:
 #include <string>
 #include <vector>

-#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h"
 #include "stdint.h"

 #include "caffe/data_layers.hpp"
diff --git a/src/caffe/layers/hdf5_data_layer.cu b/src/caffe/layers/hdf5_data_layer.cu
index 5e3e4ce..23bc02a 100644
--- a/src/caffe/layers/hdf5_data_layer.cu
+++ b/src/caffe/layers/hdf5_data_layer.cu
@@ -7,8 +7,8 @@ TODO:
 #include <string>
 #include <vector>

-#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h"

 #include "caffe/data_layers.hpp"
 #include "caffe/layer.hpp"
diff --git a/src/caffe/layers/hdf5_output_layer.cpp b/src/caffe/layers/hdf5_output_layer.cpp
index f63375c..0b57eb9 100644
--- a/src/caffe/layers/hdf5_output_layer.cpp
+++ b/src/caffe/layers/hdf5_output_layer.cpp
@@ -1,7 +1,7 @@
 #include <vector>

-#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h"

 #include "caffe/blob.hpp"
 #include "caffe/common.hpp"
diff --git a/src/caffe/layers/hdf5_output_layer.cu b/src/caffe/layers/hdf5_output_layer.cu
index ae497c3..ada682f 100644
--- a/src/caffe/layers/hdf5_output_layer.cu
+++ b/src/caffe/layers/hdf5_output_layer.cu
@@ -1,7 +1,7 @@
 #include <vector>

-#include "hdf5.h"
-#include "hdf5_hl.h"
+#include "hdf5/serial/hdf5.h"
+#include "hdf5/serial/hdf5_hl.h"

 #include "caffe/blob.hpp"
 #include "caffe/common.hpp"

robertsdionne avatar Jul 04 '15 02:07 robertsdionne

A slightly simpler solution:

diff --git a/Makefile.config.example b/Makefile.config.example
index a873502..88828cc 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -69,8 +69,8 @@ PYTHON_LIB := /usr/lib
 # 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
+INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
+LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

 # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
 # INCLUDE_DIRS += $(shell brew --prefix)/include

TheOpenSourceNinja avatar Jul 04 '15 23:07 TheOpenSourceNinja

Ah, thanks! As this goes in Makefile.config and is platform-specific, I'll close this report.

robertsdionne avatar Jul 05 '15 17:07 robertsdionne

just modify the Makefile.config works for me ! Thanks a lot :smile:

+INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ +LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

byshen avatar Nov 02 '15 03:11 byshen

It works!

datahack-ru avatar Nov 26 '15 10:11 datahack-ru

Thanks! It works for me

cuongduc avatar Feb 04 '16 05:02 cuongduc

I am on ubuntu 16.04 and it Works!

minarc avatar Feb 05 '16 13:02 minarc

@byshen, it works for me, thanks!

hustc12 avatar Feb 28 '16 07:02 hustc12

how to solve this issue on ubuntu 16.04?

vatsal12117 avatar Apr 27 '16 17:04 vatsal12117

It works for me too. Thanks. Version is ubuntu 15.10

machisuke avatar Jun 10 '16 11:06 machisuke

Thank you! It works for me. Ubuntu 16.04

vibecodingengine avatar Jun 28 '16 15:06 vibecodingengine

Thank you, it worked! Ubuntu 16.04

ghost avatar Sep 17 '16 04:09 ghost

Thank you, it worked! Ubuntu 15.04

oggata avatar Dec 07 '16 13:12 oggata

Can I suggest we add a commented out version of the above with a note "uncomment these to install on Ubuntu"?

dweekly avatar Dec 20 '16 21:12 dweekly

Its WORKS !!!!!

olypros avatar Feb 03 '17 12:02 olypros

adding these in ubuntu 16.04 works: +INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ +LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

I first verified the path exists before adding it.

manpowre avatar Jun 11 '17 22:06 manpowre

did not work for me (Ubuntu 16.04)

LD -o .build_release/lib/libcaffe.so.1.0.0 /usr/bin/ld: cannot find -lhdf5_serial_h collect2: error: ld returned 1 exit status Makefile:573: fallo en las instrucciones para el objetivo '.build_release/lib/libcaffe.so.1.0.0' make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

GonzaBCCC avatar Jun 14 '17 09:06 GonzaBCCC

@GonzaBCCC did you install the libhdf5-dev package? on Ubuntu 17.04, this actually contains hdf5-serial and development headers even though there is a package named libhdf5-serial-dev (it contains just copyright info and such)

ysangkok avatar Jul 14 '17 17:07 ysangkok

@byshen it works

yangyanglisjtu avatar Dec 26 '17 11:12 yangyanglisjtu