Dennis
Dennis

Reputation: 97

'cblas.h' error while installing Caffe on Mac OS

I followed the instructions to install Caffe (CPU only) on mac, there's an error when I run "make -j".

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

I modified the makefile.config by adding lines:

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

but it didn't solve the problem.

Any help or suggestion will be appreciated!

Upvotes: 1

Views: 4001

Answers (3)

ZHHJemotion
ZHHJemotion

Reputation: 1

You can try as below:

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

It works very well for me.

Upvotes: 0

user2567871
user2567871

Reputation: 71

Z.Kal's answer didn't help in my case, but I noticed that in case you installed the dependencies through homebrew (like I did), these two lines need uncommenting:

# 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

Worked like a charm for me afterwards! Hope this helps someone :)

Upvotes: 7

Z.Kal
Z.Kal

Reputation: 426

try to: brew uninstall openblas; brew install --fresh -vd openblas.

next, add two build flags:

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

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

Upvotes: 3

Related Questions