2016-11-18 374 views
0

我按照說明在Mac上安裝Caffe(僅限CPU),當運行「make -j」時出現錯誤。在Mac OS上安裝Caffe時'cblas.h'錯誤

In file included from src/caffe/util/blocking_queue.cpp:5: 
In file included from ./include/caffe/layers/base_data_layer.hpp:9: 
In file included from ./include/caffe/layer.hpp:12: 
In file included from ./include/caffe/util/math_functions.hpp:11: 
./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: 'cblas.h' file not found 
#include <cblas.h> 
     ^
1 error generated. 
make: *** [.build_release/src/caffe/util/blocking_queue.o] Error 1 

我加入行修改makefile.config:

USE_BLAS = apple 
ADD_LDFLAGS = -I/usr/local/opt/openblas/lib 
ADD_CFLAGS = -I/usr/local/opt/openblas/include 

但它並沒有解決問題。

任何幫助或建議將不勝感激!

回答

2

嘗試:brew uninstall openblas; brew install --fresh -vd openblas

接下來,添加兩個構建國旗:

LDFLAGS: -L/usr/local/opt/openblas/lib 

CPPFLAGS: -I/usr/local/opt/openblas/include 
+3

這對我有效。如下面的答案中所述,通過在'Makefile.config'中編輯'BLAS_INCLUDE'和'BLAS_LIB'的行來添加兩個構建標誌。 – Peter

4

Z.Kal的回答並沒有在我的情況有所幫助,但我注意到,如果你通過安裝自制軟件的依賴(像我一樣),這兩個線需要取消註釋:

# Homebrew puts openblas in a directory that is not on the standard search path 
BLAS_INCLUDE := $(shell brew --prefix openblas)/include 
BLAS_LIB := $(shell brew --prefix openblas)/lib 

工作後,像一個魅力!希望這可以幫助別人:)

+1

這適用於我!另外,請選擇「開放」而不是「地圖集」。 – alanwsx

0

您可以嘗試如下:

cmake -DCMAKE_CXX_FLAGS=-I/usr/local/opt/openblas/include .. 

它的工作對我非常好。