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

18,678

Solution 1

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.

Solution 2

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

Solution 3

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

Solution 4

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).

Share:
18,678
Ethan Keller
Author by

Ethan Keller

I've been reading a lot of Philip K. Dick.

Updated on June 25, 2022

Comments

  • Ethan Keller
    Ethan Keller almost 2 years

    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!