TanLingxiao
TanLingxiao

Reputation: 412

caffe:/usr/bin/ld: cannot find -lcblas

I have installed BLAS in my CentOS7(64 bit).But when my use make all in my

'caffe'.It reports an eror:

/usr/bin/ld: cannot find -lcblas
/usr/bin/ld: cannot find -latlas
collect2: error: ld returned 1 exit status
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc3] Error 1

I dont know why this happened and how to resolve it.

Upvotes: 4

Views: 6934

Answers (4)

user9218673
user9218673

Reputation: 31

I ended up using OpenBLAS to work around this problem.

yum install openblas-devel
sed -i 's/BLAS := atlas/BLAS := open/' Makefile.config
sed -i '/BLAS := open/aBLAS_INCLUDE := \/usr\/include\/openblas/' Makefile.config

which means install OpenBLAS and change BLAS := altas to BLAS := open and add BLAS_INCLUDE := /usr/include/openblas/ in Makefile.config. Once you have made these changes, rebuild.

Upvotes: 3

CoderOnly
CoderOnly

Reputation: 1742

1.Download atlas from here

2.Go to the root directory of the unzipped atlas. Install it using the instruction:

mkdir build
cd build 
../configure --shared
make
make install

3.Edit the Makefile.config file of caffe:

BLAS_LIB := /usr/local/atlas/lib/

/usr/local/atlas/lib/ contains libtatlas.so

Upvotes: 0

Orlando
Orlando

Reputation: 1586

First issue

sudo yum install atlas-devel

and then add the following lines to your Makefile.config

BLAS_INCLUDE := /usr/include
BLAS_LIB := /usr/lib64/atlas

in the target shared library section. The section after adding the change looks like the following

 36 # The target shared library name
 37 LIBRARY_NAME := $(PROJECT)
 38 LIB_BUILD_DIR := $(BUILD_DIR)/lib
 39 STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a
 40 DYNAMIC_VERSION_MAJOR       := 1
 41 DYNAMIC_VERSION_MINOR       := 0
 42 DYNAMIC_VERSION_REVISION    := 0-rc3
 43 DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so
 44 #DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR)
 45 DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_    MINOR).$(DYNAMIC_VERSION_REVISION)
 46 DYNAMIC_NAME := $(LIB_BUILD_DIR)/$(DYNAMIC_VERSIONED_NAME_SHORT)
 47 COMMON_FLAGS += -DCAFFE_VERSION=$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSI    ON_REVISION)
 48 
 49 BLAS_INCLUDE := /usr/include
 50 BLAS_LIB := /usr/lib64/atlas

I also faced the same problem when building caffe on the amazon deep learning ami and found the solution here: https://groups.google.com/forum/#!topic/caffe-users/Pyfp9eQoIMQ

Upvotes: 1

Anoop K. Prabhu
Anoop K. Prabhu

Reputation: 5655

sudo yum install atlas-devel to install the ATLAS library and try compiling Caffe again.

Upvotes: 0

Related Questions