Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

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

Closed
tengpeng opened this issue Feb 9, 2016 · 20 comments
Closed

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

tengpeng opened this issue Feb 9, 2016 · 20 comments

Comments

@tengpeng
Copy link
Contributor

tengpeng commented Feb 9, 2016

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
@tengpeng
Copy link
Contributor Author

tengpeng commented Feb 9, 2016

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 

@tengpeng
Copy link
Contributor Author

tengpeng commented Feb 9, 2016

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

@piiswrong
Copy link
Contributor

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.

@tengpeng
Copy link
Contributor Author

tengpeng commented Feb 9, 2016

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.

@piiswrong
Copy link
Contributor

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.

@thirdwing
Copy link
Contributor

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.

@piiswrong
Copy link
Contributor

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

@tengpeng
Copy link
Contributor Author

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

@tengpeng
Copy link
Contributor Author

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

@thirdwing
Copy link
Contributor

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

@yeomanbnu
Copy link

@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

@tengpeng
Copy link
Contributor Author

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 notifications@github.com 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
#1442 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ACmTsvXyl2fzCKC3Kr5NZkJtzvh0Q6mMks5qO2aSgaJpZM4HW3tn
.

@pengpaiSH
Copy link

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

@bigstone09
Copy link

@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?

@tengpeng
Copy link
Contributor Author

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 notifications@github.com 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
#1442 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACmTss3JI4cWszhXHyurFCktQzwZkJgMks5qyFSfgaJpZM4HW3tn
.

@liuguiyangnwpu
Copy link

liuguiyangnwpu commented Nov 1, 2016

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 !

@shadowleaves
Copy link

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

@Beastmaster
Copy link

Beastmaster commented Jan 16, 2017

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

@hschu
Copy link

hschu commented Mar 31, 2017

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

@ArmageddonKnight
Copy link
Contributor

For me, I installed extra dependency to solve this:

sudo apt-get install libatlas-base-dev

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

No branches or pull requests