(一)报错信息如下:
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:584: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
这是/usr/bin/ld找不到链接所致;
解决方案如下:
locate libhdf5
显示:一堆,这里不粘贴了,看了也没什么用;
出现了很多,都没用,关键是要知道在哪个文件夹中链接libhdf5.so文件,
经过尝试,我在
/usr/lib/x86_64-linux-gnu$中链接了/usr/lib/x86_64-linux-gnu/hdf5/openmpi中的libhdf5.so
然后在caffe文件中make all -j8 链接问题解决;
(二)
除此之外,会报错
libopencv_core.so.3.4: error adding symbols: DSO missing from command line
或者如下错误:
/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4: undefined reference to `cv::AlgorithmInfo::name[abi:cxx11]() const'
可参考博客
https://blog.csdn.net/weixin_41864878/article/details/84336717
把libopencv_core.so,libopencv_core.so.3.3,libopencv_core.so.3.3.0复制到文件夹:
/usr/local/lib/x86_64-linux-gnu
记得一定要软链接:
$ sudo chmod +r libopencv_core.so.3.3.0
$ sudo ln -sf libopencv_core.so.3.3.0 libopencv_core.so.3.3
$ sudo ln -sf libopencv_core.so.3.3 libopencv_core.so
$ sudo ldconfig
记得要到文件夹/usr/local/lib/x86_64-linux-gnu检查上述libopencv*文件,不加软连接是绿色的,正常之后是淡蓝色的;
然后再到caffe文件夹下,记住,一定要make clean,然后再make all -j8,即可编译成功;
(三)会出现fatal error: caffe/proto/caffe.pb.h: No such file or directory
参考博客:
https://blog.csdn.net/lanchunhui/article/details/58245582
作法是:进入caffe文件夹
$ protoc src/caffe/proto/caffe.proto --cpp_out=.
$ sudo mkdir include/caffe/proto
$ sudo mv src/caffe/proto/caffe.pb.h include/caffe/proto
(四)Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNA
解决方法,在make的时候加sudo;