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

/usr/bin/ld: cannot find -<library>

我在 运行 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

使用 ls -l /usr/lib/cu* 的输出编辑您的 post。另外,做 file /usr/lib/libcudart.so (我猜你的 link (ln) 是无效的。

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

确认损坏的link,进入/usr/lib/目录,再次link(ln

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

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

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