Caffe安装
1. 安装依赖
1  | luomeideMacBook-Pro:caffe luomei$ brew install -vd snappy leveldb gflags glog szip lmdb  | 
2. 下载、编译Caffe
1  | luomeideMacBook-Pro:~ luomei$ git clone https://github.com/BVLC/caffe.git  | 
开始报错了。。
先是找不到Makefile.config,原来压根没给这个文件,照着 Makefile.config.example    写了个文件。把opecvversion和cpu_only部分的注释去掉了。
看了一下是protobuf的问题,尝试了很多办法。。。
最后卸了3.6的,使用源码安装2.6的
1  | ./autogen.sh  | 
 之后记得
1  | make clean  | 
好的又报错了。。。
./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: ‘cblas.h’ file not found
#include
Makefile.config 里面原来这两句是被注释掉的,我是用homebrew安装的openblas,把注释解开就好了。
1  | # Homebrew puts openblas in a directory that is not on the standard search path  | 
fine,新的错
/usr/local/include/leveldb/status.h:26:11: error: expected ‘;’ at end of declaration list
看了一下是noexcept关键词报的错,添加C++11标准编译。
解决方法:
Makefile 中定位到
1  | ##############################  | 
添加:CXXFLAGS += -std=c++11
这句的作用就是将编译时用到的g++加上编译选项“ -std=c++11”,加上此编译选项后用的就是11标准,不加貌似默认的是98标准。
Fine,又来错了
ld: framework not found vecLib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
1  | BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/  | 
看了一下vecLib出现的地方,看了一下自己系统里的文件,发现确实是没有Headers这个文件夹,vecLib.framework这个东西倒是有。
Solve:
将 makefile 中 vecLib 引用的位置 全部替换成 openblas 的 INCLUDE 和 LIB 都替换 如下
1  | BLAS_INCLUDE := /usr/local/Cellar/openblas/0.3.0/include  |