安装caffe遇到的各种bug 总结(Ubuntu16.04下配置caffe(仅CPU))

这是caffe安装过程 中间遇到的问题下面总结:

https://blog.csdn.net/zt_1995/article/details/56283249

下面这个链接是处理这个问题填写下面语句

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

https://blog.csdn.net/forest_world/article/details/51371560

问题一:

CXX/LD -o .build_release/tools/convert_imageset.bin
.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' .build_release/lib/libcaffe.so: undefined reference tocv::imencode(cv::String const&, cv::_InputArray const&, std::vector >&, std::vector > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/convert_imageset.bin] Error 1

.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)’ .
解决:

首先,我是已经配置过了opencv的,可以这样查询安装版本:

$ pkg-config --modversion opencv

因为编译好了,理所当然,输出结果是3.4.1

所以出现上面的错误,应该是opencv_imgcodecs链接的问题,比较有效的解决方案是,把opencv需要的lib添加到Makefile文件中,找到LIBRARIES(在PYTHON_LIBRARIES := boost_python python2.7 前一行)并修改为:

LIBRARIES += glog gflags protobuf leveldb snappy \        lmdb boost_system hdf5_hl hdf5 m \        opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

在 Makefile.config中OPENCV_VERSION := 3取消注释(亲测可用) 

输入完上面后保存退出  在命令行出输入   make all 后还是报错 在命令行输入  rm -rf ./build/*       在 make clean

在 make all 后会遇到下个问题如下: 

问题二:

 

“fatal error: hdf5.h: 没有那个文件或目录”解决方法

解决:

https://blog.csdn.net/xue_wenyuan/article/details/52037121

问题三:

CXX src/caffe/solver.cpp
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc3
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:566: recipe for target '.build_release/lib/libcaffe.so.1.0.0-rc3' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0-rc3] Error 1

解决:

参考:http://blog.csdn.net/oyjxer/article/details/51824254安装,报错和你一样,
然后修改Makefile 文件(注意不是)Makefile.config 
将里面的
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5

改为LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

do as issue 12. Change the Makefile.config: 

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include   /usr/include/hdf5/serial  
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib  /usr/lib/x86_64-linux-gnu/hdf5/serial

问题三:
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail_106501::cpp_reg   相关问题

解决:

https://blog.csdn.net/CAU_Ayao/article/details/83899878

猜你喜欢

转载自blog.csdn.net/weixin_40355324/article/details/84934228