ubuntu@ubuntu-ST-KN:~/caffe$ sudo make runtest -j8
.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libcudart.so.9.0: cannot open shared object file: No such file or directory
Makefile:544: recipe for target 'runtest' failed
make: *** [runtest] Error 127
是由于找不到lib这个文件。
一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误, 比如:
tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库版本不对, 遇到这种情况那就去网上下载并安装上即可.
另外一个原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径找不到该共享库文件.
所以安装共享库后要注意共享库路径设置问题
https://www.cnblogs.com/Anker/p/3209876.html
解决方式:
执行如下命令:
ubuntu@ubuntu-ST-KN:~/caffe$ sudo cp /usr/local/cuda/lib64/libcudart.so.9.0 /usr/local/lib/libcudart.so.9.0 && sudo ldconfig
ubuntu@ubuntu-ST-KN:~/caffe$ sudo make runtest -j8
注意:
因为我的 /usr/local/cuda 是 /usr/local/cuda-9.0的symbol link,如下图所示,所以这里可以用:
sudo cp /usr/local/cuda/lib64/libcudart.so.9.0 /usr/local/lib/libcudart.so.9.0 && sudo ldconfig
代替
sudo cp /usr/local/cuda-9.0/lib64/libcudart.so.9.0 /usr/local/lib/libcudart.so.9.0 && sudo ldconfig
类似问题如下:
ubuntu@ubuntu-ST-KN:~/caffe$ sudo make runtest -j8
.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libcublas.so.9.0: cannot open shared object file: No such file or directory
Makefile:544: recipe for target 'runtest' failed
make: *** [runtest] Error 127
ubuntu@ubuntu-ST-KN:~/caffe$ sudo cp /usr/local/cuda/lib64/libcublas.so.9.0 /usr/local/lib/libcublas.so.9.0 && sudo ldconfig
ubuntu@ubuntu-ST-KN:~/caffe$ sudo make runtest -j8
.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libcurand.so.9.0: cannot open shared object file: No such file or directory
Makefile:544: recipe for target 'runtest' failed
make: *** [runtest] Error 127
ubuntu@ubuntu-ST-KN:~/caffe$ sudo cp /usr/local/cuda/lib64/libcurand.so.9.0 /usr/local/lib/libcurand.so.9.0 && sudo ldconfig
ubuntu@ubuntu-ST-KN:~/caffe$ sudo make runtest -j8
.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libcudnn.so.7: cannot open shared object file: No such file or directory
Makefile:544: recipe for target 'runtest' failed
make: *** [runtest] Error 127
ubuntu@ubuntu-ST-KN:~/caffe$ sudo cp /usr/local/cuda/lib64/libcudnn.so.7 /usr/local/lib/libcudnn.so.7 && sudo ldconfig
ubuntu@ubuntu-ST-KN:~/caffe$ sudo make runtest -j8