1. 程式人生 > >安裝caffe遇到的各種bug 總結(Ubuntu16.04下配置caffe(僅CPU))

安裝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