Compile caffe under Ubuntu14.04

Use make to compile caffe
1. Under the caffe path

cp Makefile.config.example Makefile.config

Unable to get "Makefile.config.example" file status (stat): No such file or directory
Solution : Give Makefile.config.example an absolute path

2. Open Makefile.config to modify

CPU_ONLY := 1
WITH_PYTHN_LAYER:=1

3. Compile make

make

An error occurred
fatal error: hdf5/serial/hdf5.h: no such file or directory
See where hdf5.h is

 locate hdf5.h

write picture description here
hdf5.h in /usr/local/
Modify Makefile.config

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib

An error occurred

/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct’ can not be used when making a shared object; recompile with -fPIC
/usr/lib/x86_64-linux-gnu/libboost_python.so:对‘PyUnicodeUCS4_AsWideChar’未定义的引用

Solution: Recompile python
into the python source folder

cd python
./configure --prefix=/usr/local/  –enable-shared CFLAGS=-fPIC  --enable-unicode=ucs4
make sudo make install


4. An error occurred with make pycaffe : make: * No rules to create target "include/caffe/layers/python_layer.hpp" required by "python/caffe/_caffe.so".
Solution: Copy python_layer.hpp to include/caffe/layers/

5.make runtest
write picture description here

6. Run a py: F0325 15:14:02.263409 10102 common.cpp:55] Cannot use GPU in CPU-only Caffe: check mode.

CPU-ONLY in CMakeLists.txt should be set to ON

recompile

make clean
make pycaffe
make runtest

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325560695&siteId=291194637