“/usr/bin/ld: cannot find -lopenblas” error in Caffe compilation

夙愿已清 提交于 2020-07-06 12:06:56

问题


When I was compiling Caffe, I had this error, despite OpenBLAS is installed:

AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so
/usr/bin/ld: cannot find -lopenblas
collect2: ld devolvió el estado de salida 1
make: *** [.build_release/lib/libcaffe.so] Error 1

Is there a solution for it?


回答1:


Including the base packs even after cloning OpenBlas and making will link the appropriate libraries in 14.04 and 16.

apt install liblapack-dev liblapack3 libopenblas-base libopenblas-dev

apt install liblapack-dev liblapack3 libopenblas-base libopenblas-dev




回答2:


I faced the same problem. Even adding library directory "/opt/OpenBLAS/lib/" to ldconfig cache didn't help (as my libopenblas.so is at "/opt/OpenBLAS/lib/libopenblas.so").

Using cmake helped me. Try this from caffe root directory:

mkdir build cd build cmake -DBLAS=open .. make all make runtest

If you need to use make, add the symlink of libopenblas.so to /usr/lib. I did the following:

ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib/libopenblas.so




回答3:


I saw the similar problem (I'm compiling caffe again for some reason). I found the library file the builder is looking for (-lcblas or -latlas means libcblas.so and libatlas.so) are under /usr/lib64/atlas. So just added symbolic links under /usr/lib64 like this.

sudo ln /usr/lib64/atlas/libcblas.so.3.0 /usr/lib64/libcblas.so
sudo ln -s /usr/lib64/atlas/libatlas.so.3.0 /usr/lib64/libatlas.so

But I guess more proper method is to set Makefile.config (the CBLAS path). (I thought the default path will do away with it reading the comment saying so, but it did not.) Hope this helps anyone.



来源:https://stackoverflow.com/questions/32353509/usr-bin-ld-cannot-find-lopenblas-error-in-caffe-compilation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!