Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Caffe on Mac error: "fatal error: 'cblas.h' file not found"

Tags:

macos

caffe

I've been following this guide to install on my El Capitan macbook pro, using CMake to build the makefile. However, when I attempt to make, I run into the error of missing the cblas.h file. I successfully reinstalled openblas with:

$ brew uninstall openblas; brew install --fresh -vd openblas

and adding the two build flags:

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

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

However I still get the error. Then I reinstalled CUDA and xcode-select install tools as recommended here.

Any recommendations/further speculation about why make doesn't see my cblas.h file is appreciated!

like image 854
Ethan Keller Avatar asked Feb 22 '16 01:02

Ethan Keller


4 Answers

In your question I see cmake, but in provided link Makefile.config.

If you're still want to proceed with cmake:

first of all, build script is NOT broken - I tried it on Yosemite with the latest master branch (2016-02-25), but you should slightly adjust it if you already made

brew uninstall openblas; brew install --fresh -vd openblas

Just run your cmake with additional arguments:

cmake -DCMAKE_CXX_FLAGS=-I/usr/local/opt/openblas/include <path to your sources>

and then usual make or xcode build (depends on what generator you use).

After this it was successfully built on my system.

UPD: you can also use libraries in Accelerate.framework (vecLib) instead of openblas.

like image 73
avtomaton Avatar answered Dec 29 '22 12:12

avtomaton


Go to the Makefile.config and edit the following lines with the path where your openblas is located, in my case the version is 0.2.18_2

Be sure to uncomment these lines:

BLAS_INCLUDE := /usr/local/Cellar/openblas/0.2.18_2/include
BLAS_LIB := /usr/local/Cellar/openblas/0.2.18_2/lib
like image 33
Juan Zapata Avatar answered Dec 29 '22 13:12

Juan Zapata


Uncomment this lines in Makefile.config:

# 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
like image 29
mayo Avatar answered Dec 29 '22 12:12

mayo


I ran into this issue myself today and submitted a pull request to mainline Caffe:

https://github.com/BVLC/caffe/pull/4247

For me, the issue was that Caffe was finding the deprecated vecLib framework (which doesn't ship cblas.h) instead of the new Accelerate framework (which does ship cblas.h).

like image 36
jklontz Avatar answered Dec 29 '22 13:12

jklontz