/ usr / bin / ld:找不到 - <library>

时间:2015-10-27 18:40:07

标签: cuda caffe

我在运行make-and-install.sh caffe时遇到错误。我已将/usr/local/cuda/libcudart.so链接到/usr/lib/libcudart.so以及其他文件

g++ .build_release/tools/caffe.o .build_release/lib/libcaffe.a -o .build_release/tools/caffe.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
g++ .build_release/tools/dump_network.o .build_release/lib/libcaffe.a -o .build_release/tools/dump_network.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
g++ .build_release/tools/extract_features.o .build_release/lib/libcaffe.a -o .build_release/tools/extract_features.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
make: *** [.build_release/tools/extract_features.bin] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
make: *** [.build_release/tools/dump_network.bin] Error 1
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
make: *** [.build_release/tools/caffe.bin] Error 1
g++ .build_release/tools/caffe.o .build_release/lib/libcaffe.a -o .build_release/tools/caffe.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
make: *** [.build_release/tools/caffe.bin] Error 1
tarun@tarun-Inspiron-3542:~/Desktop/SA_project/sirius-caffe$ ln -s /usr/local/cuda/lib/libcuda.so.7.5 /usr/lib/libcuda.so.7.5
ln: failed to create symbolic link ‘/usr/lib/libcuda.so.7.5’: File exists
tarun@tarun-Inspiron-3542:~/Desktop/SA_project/sirius-caffe$ sudo ./make-and-install.s
sudo: ./make-and-install.s: command not found
tarun@tarun-Inspiron-3542:~/Desktop/SA_project/sirius-caffe$ sudo ./make-and-install.sh
g++ .build_release/tools/caffe.o .build_release/lib/libcaffe.a -o .build_release/tools/caffe.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
g++ .build_release/tools/dump_network.o .build_release/lib/libcaffe.a -o .build_release/tools/dump_network.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
g++ .build_release/tools/extract_features.o .build_release/lib/libcaffe.a -o .build_release/tools/extract_features.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
make: *** [.build_release/tools/extract_features.bin] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
make: *** [.build_release/tools/dump_network.bin] Error 1
make: *** [.build_release/tools/caffe.bin] Error 1
g++ .build_release/tools/caffe.o .build_release/lib/libcaffe.a -o .build_release/tools/caffe.bin -fPIC -DNDEBUG -O2 -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/include -I.build_release/src -I./src -I./include -I/usr/local/include/opencv2/core/include -Wall -Wno-sign-compare -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/local/include/opencv2/core/lib -lcudart -lcublas -lcurand -lglog -lgflags -lprotobuf -lleveldb -lsnappy -llmdb -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_imgproc -lpthread -lboost_thread -lopenblas
/usr/bin/ld: cannot find -lcudart
/usr/bin/ld: cannot find -lcublas
/usr/bin/ld: cannot find -lcurand
collect2: ld returned 1 exit status
make: *** [.build_release/tools/caffe.bin] Error 1

任何形式的帮助将不胜感激。

库或路径是否存在问题。

编辑以添加

ls -l /usr/lib/cu*

total 32
drwxr-xr-x 2 root root 4096 Aug 29 22:11 backend
drwxr-xr-x 2 root root 4096 Aug 11 11:07 backend-available
drwxr-xr-x 2 root root 4096 Aug 11 11:07 cgi-bin
drwxr-xr-x 2 root root 4096 Aug 11 11:07 daemon
drwxr-xr-x 2 root root 4096 Aug 11 11:07 driver
drwxr-xr-x 2 root root 4096 Aug 11 11:07 filter
drwxr-xr-x 2 root root 4096 Aug 11 11:07 monitor
drwxr-xr-x 2 root root 4096 Aug 11 11:07 notifier

1 个答案:

答案 0 :(得分:1)

使用ls -l /usr/lib/cu*的输出编辑您的帖子。另外,请file /usr/lib/libcudart.so(我猜你的链接(ln)无效。

^^^^^已经完成^^^^^

确认已断开的链接后,请转到/usr/lib/目录并再次链接(ln)。

ln -s /usr/local/cuda/libcudart.so /usr/lib/libcudart.so

对所有需要的库执行此步骤。 正如@RobertCrovella所提到的,似乎还需要一些图书馆知识,所以添加-L/usr/local/cuda/lib64

现在,在输入所有内容之后,我建议不要移动/链接任何文件,只需添加-L /usr/local/cuda -L/usr/local/cuda/lib64即可找到所有的cuda库。