hi all,
I am encountering the blas compile issue on EI Capitan. I searched and found similar questions about it, saying reason might be bias not installed. So I installed openblas thru brew, changed config file as "USE_BLAS = openblas". No luck. And I also tried to export LIBRARY_PATH=/usr/local/Cellar/openblas/0.2.15/include/, still got the exactly same error as below.
Anyone shed some light?
In file included from include/mxnet/base.h:13:
In file included from ./mshadow/mshadow/tensor.h:16:
./mshadow/mshadow/./base.h:120:14: fatal error: 'cblas.h' file not found
#include
^
In file included from src/c_api/c_predict_api.cc:9:
In file included from include/mxnet/symbolic.h:17:
In file included from include/mxnet/./base.h:13:
In file included from ./mshadow/mshadow/tensor.h:16:
./mshadow/mshadow/./base.h:120:14: fatal error: 'cblas.h' file not found
#include
^
In file included from src/c_api/c_api.cc:11:
In file included from include/mxnet/base.h:13:
In file included from ./mshadow/mshadow/tensor.h:16:
./mshadow/mshadow/./base.h:120:14: fatal error: 'cblas.h' file not found
#include
^
In file included from src/common/tblob_op_registry.cc:6:
In file included from include/mxnet/ndarray.h:17:
In file included from include/mxnet/./base.h:13:
In file included from ./mshadow/mshadow/tensor.h:16:
./mshadow/mshadow/./base.h:120:14: fatal error: 'cblas.h' file not found
#include
^
1 error generated.
1 error generated.
1 error generated.
1 errormake: *** [build/common/tblob_op_registry.o] Error 1 generated.
make: ** Waiting for unfinished jobs....
make: ** [build/c_api/c_predict_api.o] Error 1
make: ** [build/resource.o] Error 1
make: ** [build/c_api/c_api.o] Error 1
actually, I used "USE_BLAS = apple" at the very beginning, but encounter the same build failure. Then I thought my bias was not installed correctly, then I tried open blas....
You want to add the path to CPLUS_INCLUDE_PATH and C_INCLUDE_PATH. Or add them in -I flag in the ADD_CFLAGS
modify the config.mk like this
USE_BLAS = apple
ADD_LDFLAGS = -I/usr/local/opt/openblas/lib
ADD_CFLAGS = -I/usr/local/opt/openblas/include
I had the exact similar issue before and my solution was: adding /usr/local/include and /usr/local/lib to the PATH, and USE_BLAS = apple
thanks, the issue was resolved by adding ADD_LDFLAGS and ADD_CFLAGS
As a reference, if those 3 lines are added to make/osx.mk
, then the bash command in the docs remain the same:
cd mxnet; cp make/osx.mk ./config.mk; make -j$(sysctl -n hw.ncpu)
For ADD_LDFLAGS
, it should be -L
I also meet this error:
In file included from /data/apps/mxnet/mshadow/mshadow/tensor.h:16:0,
from include/mxnet/./base.h:13,
from include/mxnet/operator_util.h:24,
from src/operator/tensor/./elemwise_unary_op.h:9,
from src/operator/tensor/elemwise_binary_scalar_op_extended.cc:6:
/data/apps/mxnet/mshadow/mshadow/./base.h:136:23: fatal error: cblas.h: No such file or directory #include
my environment:
centos 7
gcc 4.8.5
glibc 2.17
opencv 2.4.13
openblas 0.2.19
I also vim .bashrc
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib64:/opt/openblas/lib:/data/apps/opencv-2.4.13/release/lib
sudo ldconfig
I try to fix the config.mk and fianlly build succussfully.
ADD_LDFLAGS = -I/opt/OpenBLAS/lib
ADD_CFLAGS = -I/opt/OpenBLAS/include
USE_BLAS = openblas
If you don't have libopenblas.so in your /usr/lib , then you can do the following thing, otherwise you maybe encouter the error: usr bin ld cannot find lopenblas
ln -s /xxx/OpenBLAS/lib/libopenblas.so /usr/lib/libopenblas.so
First install openblas
$ brew install --fresh -vd openblas
......
macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openblas/lib
CPPFLAGS: -I/usr/local/opt/openblas/include
==> Summary
🍺 /usr/local/Cellar/openblas/0.2.18_2: 20 files, 41.8M, built in 12 minutes 33 seconds
Then Add ADD_LDFLAGS
and ADD_CFLAGS
to config.mk:
USE_BLAS = apple
ADD_LDFLAGS = -I/usr/local/opt/openblas/lib
ADD_CFLAGS = -I/usr/local/opt/openblas/include
apt-get install libblas-dev liblapack-dev
OS used : MacOS
I am sorry ,
But where is this config.mk or osx.mk file?
OS used : MacOS
I am sorry ,But where is this config.mk or osx.mk file?
cp make/osx.mk ./config.mk
then, find “USE_BLAS = apple” line
add
Most helpful comment
modify the config.mk like this