Incubator-mxnet: "/usr/bin/ld: cannot find -lcblas"

Created on 10 Feb 2016  Â·  20Comments  Â·  Source: apache/incubator-mxnet

I am compiling the packages on CentOS 7, but get error

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

What I tried:

  1. Installed atlas packages
  2. Link the libraries
# the additional link flags you want to add
ADD_LDFLAGS = -L/usr/lib64/atlas -L/usr/include

# the additional compile flags you want to add
ADD_CFLAGS = -L/usr/lib64/atlas -L/usr/include

Most helpful comment

Here's my solution. (CentOS 7)

  1. Edit Makefile.config (line 54-55)
    BLAS_INCLUDE := /usr/include/atlas
    BLAS_LIB := /usr/lib64/atlas

  2. Change Makefile (line 384)
    LIBRARIES += cblas atlas
    ==>
    LIBRARIES += satlas tatlas

All 20 comments

locate blas
/usr/include/cblas.h
/usr/lib64/libreoffice/share/gallery/htmlexpo/cublast.gif
/usr/lib64/libreoffice/share/gallery/htmlexpo/cublast_.gif
/usr/lib64/pkgconfig/cublas-7.5.pc
/usr/local/cuda-7.5/doc/html/cublas
/usr/local/cuda-7.5/doc/html/nvblas
/usr/local/cuda-7.5/doc/html/cublas/graphics
/usr/local/cuda-7.5/doc/html/cublas/index.html
/usr/local/cuda-7.5/doc/html/cublas/graphics/cublasmg_gemm.jpg
/usr/local/cuda-7.5/doc/html/nvblas/index.html
/usr/local/cuda-7.5/doc/man/man7/libcublas.7
/usr/local/cuda-7.5/doc/man/man7/libcublas.so.7
/usr/local/cuda-7.5/targets/x86_64-linux/include/cublas.h
/usr/local/cuda-7.5/targets/x86_64-linux/include/cublasXt.h
/usr/local/cuda-7.5/targets/x86_64-linux/include/cublas_api.h
/usr/local/cuda-7.5/targets/x86_64-linux/include/cublas_v2.h
/usr/local/cuda-7.5/targets/x86_64-linux/include/nvblas.h
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so.7.5
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so.7.5.18
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas_device.a
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas_static.a
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libnvblas.so
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libnvblas.so.7.5
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libnvblas.so.7.5.18
/usr/local/cuda-7.5/targets/x86_64-linux/lib/stubs/libcublas.so
/usr/share/doc/atlas-devel-3.10.1/doc/cblas.pdf
/usr/share/doc/atlas-devel-3.10.1/doc/cblasqref.pdf
/usr/share/doc/atlas-devel-3.10.1/doc/f77blasqref.pdf
/var/cuda-repo-7-5-local/cuda-cublas-7-5-7.5-18.x86_64.rpm
/var/cuda-repo-7-5-local/cuda-cublas-dev-7-5-7.5-18.x86_64.rpm
[pt@MiWiFi-R2D-srv mxnet]$ cat config.mk 

locate atlas | grep lib
/usr/lib/modules/3.10.0-327.4.5.el7.x86_64/kernel/drivers/input/misc/atlas_btns.ko
/usr/lib/modules/3.10.0-327.el7.x86_64/kernel/drivers/input/misc/atlas_btns.ko
/usr/lib64/atlas
/usr/lib64/atlas/libsatlas.so
/usr/lib64/atlas/libsatlas.so.3
/usr/lib64/atlas/libsatlas.so.3.10
/usr/lib64/atlas/libtatlas.so
/usr/lib64/atlas/libtatlas.so.3
/usr/lib64/atlas/libtatlas.so.3.10
/var/lib/alternatives/atlas-inc

atlas should include a libcblas.so. Locate it and add its path to flags. If you can't find it, your atlas is probably not correctly installed.

I tried reinstall altas packages, but the error persists.

  • Is it libcblas.so or libcUblas.so ?
[pt@MiWiFi-R2D-srv mxnet]$ locate libcublas.so
/usr/local/cuda-7.5/doc/man/man7/libcublas.so.7
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so.7.5
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so.7.5.18
/usr/local/cuda-7.5/targets/x86_64-linux/lib/stubs/libcublas.so
[pt@MiWiFi-R2D-srv mxnet]$ locate libcblas.so
[pt@MiWiFi-R2D-srv mxnet]$ 
  • I tried search libcblas.so on repo, but didn't find it.
sudo yum search libcblas.so
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: chicago.gaminghost.co
 * epel: mirror.steadfast.net
 * extras: cosmos.illinois.edu
 * remi-safe: mirrors.mediatemple.net
 * rpmforge: mirror.team-cymru.org
 * updates: centos.mirrors.tds.net
 * webtatic: us-east.repo.webtatic.com
Warning: No matches found for: libcblas.so
No matches found

I understand the name of libcblas.so may be different in centOS. However, given that I have reinstalled altas, I am confused why I cannot get it passed.

Here is my output of locate libcblas:

locate libcblas
/usr/lib/libcblas.a
/usr/lib/libcblas.so
/usr/lib/libcblas.so.3
/usr/lib/libcblas.so.3gf
/usr/lib/atlas-base/libcblas.a
/usr/lib/atlas-base/libcblas.so
/usr/lib/atlas-base/libcblas.so.3
/usr/lib/atlas-base/libcblas.so.3.0

Seems like an issue with atlas on different platforms. I suggest you look into atlas's documents or switch to other blas libraries, like Openblas.

On CentOS/Fedora/Red Hat, please change -lcblas to -lsatlas in https://github.com/dmlc/mshadow/blob/master/make/mshadow.mk#L56

Maybe this should be added into documents.

@thirdwing Maybe we can do auto detect. uname -a gives distro name.

Solved. Thanks! I am crying seeing the terminal running like crazy.

One more question: how do I find out the library name for X OS, if only library name for Y os is given?

I don't think this is a general answer for this.

@tengpeng ,can you please post your solution here. I ran into the same problem and tried to replace to "ADD_LDFLAGS +=-lsatlas" but still got "cannot find -lcblas" error

Please refer to Eric's answer which help me solve the problem.

atlas should include a libcblas.so. Locate it and add its path to flags. If you can't find it, your atlas is probably not correctly installed.

On Fri, Jun 24, 2016 at 12:09 AM, yeoman [email protected] wrote:

@tengpeng https://github.com/tengpeng ,can you please post your
solution here. I ran into the same problem and tried to replace to
"ADD_LDFLAGS +=-lsatlas" but still got "cannot find -lcblas" error

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dmlc/mxnet/issues/1442#issuecomment-228259370, or mute
the thread
https://github.com/notifications/unsubscribe/ACmTsvXyl2fzCKC3Kr5NZkJtzvh0Q6mMks5qO2aSgaJpZM4HW3tn
.

Hi, all. In order to help others who may run into this problem. I fix the error by creating a soft link as below:
cd /usr/lib64
ln -s libcblas.so.3 libcblas.so

@tengpeng I'm tring to install mxnet on CentOS7, but I run into the same error with "/usr/bin/ld: cannot find -lcblas" , could you post a step-by-step tutorial to share your experience in installing mxnet on CentOS?

I don't have CentOS access anymore. But I am sure this problem can be
solved by 1. try everything on this issue. 2. search installation guides on
lcblas 3. look at caffe library's installation guide.

On Sat, Oct 8, 2016 at 9:42 PM, bigstone09 [email protected] wrote:

@tengpeng https://github.com/tengpeng I'm tring to install mxnet on
CentOS7, but I run into the same error with "/usr/bin/ld: cannot find
-lcblas" , could you post a step-by-step tutorial to share your experience
in installing mxnet on CentOS?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/dmlc/mxnet/issues/1442#issuecomment-252460687, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACmTss3JI4cWszhXHyurFCktQzwZkJgMks5qyFSfgaJpZM4HW3tn
.

OS : Centos7.2
Software: CaffeOnSpark
if you want to use atlas, Please modified the caffe-public/Makefile, cblas -> satlas , atlas -> tatlas ,
and you also modified the caffe-distribute/Makefile , cblas -> satlas, atlas -> tatlas.
run this comand

make clean
make build

will fix this bug !

Thanks for the useful information above. adding "-L/usr/lib64/atlas" to ADD_LDFLAGS in config.mk and changing -lcblas to -lsatlas in mxnet/mshadow/make/mshadow.mk will fix the ld error on Centos 7 with ATLAS. I can also confirm that the ATLAS on centos 7 does not ship with libcblas.so. @tengpeng @thirdwing

I solved this problem by replacing cblas with satlas. Here is solution:

  1. open Makefile in caffe source dir and locate "cblas"
  2. Replace "cblas" with "satlas"

Note: My system is fedora 23

Here's my solution. (CentOS 7)

  1. Edit Makefile.config (line 54-55)
    BLAS_INCLUDE := /usr/include/atlas
    BLAS_LIB := /usr/lib64/atlas

  2. Change Makefile (line 384)
    LIBRARIES += cblas atlas
    ==>
    LIBRARIES += satlas tatlas

For me, I installed extra dependency to solve this:

sudo apt-get install libatlas-base-dev
Was this page helpful?
0 / 5 - 0 ratings

Related issues

WangcsShuai picture WangcsShuai  Â·  3Comments

JonBoyleCoding picture JonBoyleCoding  Â·  3Comments

dmadeka picture dmadeka  Â·  3Comments

dushoufu picture dushoufu  Â·  3Comments

sbodenstein picture sbodenstein  Â·  3Comments