Ubuntu16.04在安装caffe过程中,在执行make all -j8后报错

如图所示,错误信息为
CXX .build_release/src/caffe/proto/caffe.pb.cc
In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:9:42: fatal error: google/protobuf/stubs/common.h: 没有那个文件或目录
 #include <google/protobuf/stubs/common.h>
                                          ^
compilation terminated.
Makefile:588: recipe for target '.build_release/src/caffe/proto/caffe.pb.o' failed
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1

 
2017-07-17_21-42-29屏幕截图.jpg
已邀请:

青枫桥影

赞同来自: CatherineW

sudo apt-get install git
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev
libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install python-dev
sudo apt-get insall libgflags-dev libgoogle-glog-dev liblmdb-dev
你的依赖库没有装好,可怕。

青枫桥影

赞同来自:

libprotobuf-dev是否装过了?

时光行者 - IT男

赞同来自:

没有安装libprotobuf-dev,我安装之后,再次编译,报了
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"这个错,然后参考解决方法为:
缺少了google的kv数据库:leveldb,这个在installation.md中的Optional dependencies也提到了。
从这里下载:https://github.com/google/leveldb
输入sudo git clone https://github.com/google/leveldb.git
参考:https://techoverflow.net/blog/ ... inux/
解压后,在解压的文件夹里make
因为没有不支持install,所以,要手工将这些include和生成的lib拷贝到需要的地方。
输入sudo cp --preserve=links out-shared/libleveldb.so* /usr/local/lib #只拷贝了动态库。
输入sudo cp -r include/leveldb/ /usr/local/include/
再次make,报错:hdf5.h:没有那个文件或目录,解决方法:
1. 安装hdf5:sudo apt install libhdf5-serial-dev
2. 更改Makefile:INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial 
再次make,出现错误:/usr/bin/ld: 找不到 -lsnappy
collect2: error: ld returned 1 exit status
Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
我正在解决

要回复问题请先登录注册