Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cblas missing, cannot build using make or cmake OSX 10.10 #36

Open
matthewbahr opened this issue Mar 6, 2016 · 22 comments
Open

cblas missing, cannot build using make or cmake OSX 10.10 #36

matthewbahr opened this issue Mar 6, 2016 · 22 comments

Comments

@matthewbahr
Copy link

I get 3% of the way into building after cmake fires off correctly from a build directory using $ cmake ... Using make manually from Caffe just results in there being the same error:

fatal error:
  'cblas.h' file not found
#include <cblas.h>
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/blob.cpp.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

I've looked around and most of the results I've found talk about using CUDA and that's clearly not an option. I have tried reinstalling all of my dependencies via homebrew, I've tried using standard make passing in compile params like $ make all -L /usr/local/Cellar/openblas/0.2.15/lib -I /usr/local/Cellar/openblas/0.2.15/include and followed this suggestion:

The only changes I needed to make to the source code were to replace #include <CL/...> with #include <OpenCL/...> in these files:

include/caffe/common.hpp
include/caffe/util/math_functions.hpp
and to remove #include <malloc.h> from src/caffe/device.cpp

I haven't seen anyone else having these same issues but I'm assuming I'm just doing something stupid and failing to actually link correctly somewhere.

Help?

@gujunli
Copy link
Contributor

gujunli commented Mar 9, 2016

it seems that you did not set up your cBLAS library. which c version of BLAS you are using? you should set up the path variables so the cake will find colas.h file.
thanks
junli

On Mar 5, 2016, at 10:18 PM, matthewbahr [email protected] wrote:

I get 3% of the way into building after cmake fires off correctly from a build directory using $ cmake ... Using make manually from Caffe http://caffe.berkeleyvision.org/installation.html#compilation just results in there being the same error:

fatal error:
'cblas.h' file not found
#include <cblas.h>
make[2]: *** [src/caffe/CMakeFiles/caffe.dir/blob.cpp.o] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2
I've looked around and most of the results I've found talk about using CUDA and that's clearly not an option. I have tried reinstalling all of my dependencies via homebrew, I've tried using standard make passing in compile params like $ make all -L /usr/local/Cellar/openblas/0.2.15/lib -I /usr/local/Cellar/openblas/0.2.15/include and followed this suggestion:

The only changes I needed to make to the source code were to replace #include with #include <OpenCL/...> in these files:

include/caffe/common.hpp
include/caffe/util/math_functions.hpp
and to remove #include <malloc.h> from src/caffe/device.cpp

I haven't seen anyone else having these same issues but I'm assuming I'm just doing something stupid and failing to actually link correctly somewhere.

Help?


Reply to this email directly or view it on GitHub #36.

@matthewbahr
Copy link
Author

I was using OpenBLAS, is that not a c BLAS? I also set the BLAS attributes in the Makefile.config to be BLAS := open.

Should I be setting the BLAS somewhere other than Makefile.config?

@victorv
Copy link

victorv commented Mar 17, 2016

brew install openblas to get the required includes in /usr/local/include

@matthewbahr
Copy link
Author

I installed openblas with Homebrew before all of this already. Like I said:

"I have tried reinstalling all of my dependencies via homebrew"

Brew list returns this:
boost gcc jpeg lmdb openexr boost-python gflags leveldb mpfr protobuf clblas gmp libmpc numpy snappy cmake ilmbase libpng openblas szip eigen isl libtiff opencv

@victorv
Copy link

victorv commented Mar 22, 2016

You need to uncomment include and lib defines to add openblas from brew. It is just below where BLAS := open

@matthewbahr
Copy link
Author

Here's what it was when I opened it up just now:

BLAS choice:

atlas for ATLAS (default)

mkl for MKL

open for OpenBlas

BLAS := open

Custom (MKL/ATLAS/OpenBLAS) include and lib directories.

Leave commented to accept the defaults for your choice of BLAS

(which should work)!

BLAS_INCLUDE := /path/to/your/blas

BLAS_LIB := /path/to/your/blas

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

Shouldn't that already be including Homebrew OpenBLAS?

Thanks for walking through this step by step with me.

@victorv
Copy link

victorv commented Mar 22, 2016

That should be all you need. The cblas.h file should be in/usr/local/opt/openblas/include/ as openblas must be installed away from /usr/local/include to avoid conflicts. make clean all may be required to remove any old dependencies generated from prior Makefiles.

@matthewbahr
Copy link
Author

Thanks Victor. It's still not compiling. I just made a fresh directory and reconfigured everything from scratch but I'm still getting the same error.

I've looked at my file structure and found cblas.h but for some reason the compilation isn't seeing it.

Is there a way to manually specify the dir of cblas.h in my Makefile besides the standard defining of OpenBLAS? Maybe in the # Whatever else you find you need goes here. section of the makefile?

Or could I bring it in to a root area for the actual make?

I'm grasping at straws here.

@dendisuhubdy
Copy link

Same happened for me too on 10.11

@matthewbahr
Copy link
Author

@dendisuhubdy Did you ever fix it?

@dendisuhubdy
Copy link

@matthewbahr it's been 5 days now. I tried changing

# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas

to include the BLAS include and library directories. It didn't work too. Is there any confirmation that the compilation works on Ubuntu 14.04?

@victorv
Copy link

victorv commented Mar 27, 2016

What does brew --prefix openblas return?

@matthewbahr
Copy link
Author

My brew --prefix openblas returns /usr/local/opt/openblas

I just upgraded to OSX 10.11.5 and am trying again.

@matthewbahr
Copy link
Author

@dendisuhubdy Unsure if there is any confirmation. I'm trying it on 10.11.5 because I recently updated.

@tpanum
Copy link

tpanum commented Jun 21, 2016

This solved the problem for me: cmake -DCMAKE_CXX_FLAGS=-I/usr/local/opt/openblas/include ..

@KeeganRen
Copy link

@tpanum thanks!

@ShivangiM
Copy link

@tpanum Do I need to add it to MakeFile.config ?

@tpanum
Copy link

tpanum commented Sep 12, 2016

@ShivangiM No, just add the flag I mentioned to the cmake command in the shell.

@jurastm
Copy link

jurastm commented Sep 19, 2016

@tpanum thank you. It works

@ZHHJemotion
Copy link

@tpanum thanks a lot. It works very well.

@navy-xie
Copy link

navy-xie commented Jul 6, 2017

The instruction below works for me.

  1. excute the command below to install blas
$ brew install openblas
  1. modify 'Makefile.config'
# set to open
BLAS := open
# uncomment below 2 lines
BLAS_INCLUDE := $(shell brew --prefix openblas)/include
BLAS_LIB := $(shell brew --prefix openblas)/lib

@heshameraqi
Copy link

@navy-xie That is neat and works. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests