环境: ubuntu 16.10 python 3.5 cuda 8.0 cudnn 5.1
1.
# glog
wget https://google-glog.googlecode.com/files/glog-0.3.3.tar.gz
tar zxvf glog-0.3.3.tar.gz
cd glog-0.3.3
./configure
make && make install
# gflags
wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=1
make && make install
# lmdb
git clone https://github.com/LMDB/lmdb
cd lmdb/libraries/liblmdb
make && make install
2.cp Makefile.config.example Makefile.config
# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN is desired)
改:
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
为:(因为我的arrayobject.h在另外lib64的路径下)
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib64/python2.7/site-packages/numpy/core/include
修改:打开CPU_ONLY := 1,并注释掉:USE_CUDNN := 1。因为我的电脑没有gpu相关的东西。
3.src/caffe/layers/hdf5_data_layer.cpp:13:18: fatal error: hdf5.h: No such file or directory
#include "hdf5.h"
记得上面已经安装了hdf5-devel,怎么会出这个错?查看一下,发现yum这个没找到hdf5-devel,所以也就没有安装。
在docs/installion.md中,建议:but we suggest first installing the [Anaconda](https://store.continuum.io/cshop/anaconda/) Python distribution, which provides most of the necessary packages, as well as the `hdf5` library dependency.
准备安装hdf5:
http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.16.tar
解压后:
./configure --prefix=/usr/local/hdf5-1.8.3 ##指定安装路径,否则会默认安装到当前路径下。
make ##4分钟左右
make install
4.In file included from src/caffe/util/db.cpp:2:0:
./include/caffe/util/db_leveldb.hpp:7:24: fatal error: leveldb/db.h: No such file or directory
#include "leveldb/db.h"
^
compilation terminated.
缺少了google的kv数据库:leveldb,这个在installation.md中的Optional dependencies也提到了。
5.cannot find -lsnappy
sudo apt-getinstall libhdf5-serial-dev libleveldb-dev libsnappy-dev liblmdb-dev
6.cannot find -lcblas
sudo apt-get install libatlas-base-dev
7.undefined reference to `cv::imread(cv::String const&, int)'
I found I installed opencv 3.0. and I change the Makefile.config. It works.
[root@localhost caffe-master]# make runtest
.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libhdf5_hl.so.100: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127
再来:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/hdf5-1.10.0/lib
8. ImportError:caffe.so: undefined symbol: _ZN5caffe4mtx_E
Makefile.config
Uncomment to support layers written in Python (will link against Python libs)
WITH_PYTHON_LAYER := 1
网友评论