安装caffe时找不到-lopencv_imgcodecs和-lopencv_videoio

时间:2017-03-29 09:15:17

标签: makefile compilation caffe

我在Ubuntu 16.04上使用opencv3.0 +和CUDA安装Caffe时遇到了问题

我还在我的Makefile中添加了opencv_imgcodescs和opencv_videoio,但是没有解决问题。

我已经检查了Caffe用户组的几个答案,但没有答案可以解决我的问题。

我的错误讯息:

nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0-rc3
/usr/bin/ld: cannot find -lopencv_imgcodecs
/usr/bin/ld: cannot find -lopencv_videoio
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

我在Makefile中的设置

LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio

我的imgcodecs和videoio在〜/ miniconda2 / envs / frcnn / include / opencv2 /

(fastrcnn) pohsuan@pohsuan-Predator-G9-592:~/miniconda2/envs/fastrcnn/include/opencv2$ ls
aruco            dnn.hpp         imgcodecs            photo          structured_light      videostab
aruco.hpp        dpm.hpp         imgcodecs.hpp        photo.hpp      structured_light.hpp  videostab.hpp
bgsegm.hpp       face            imgproc              plot.hpp       superres              xfeatures2d
bioinspired      face.hpp        imgproc.hpp          reg            superres.hpp          xfeatures2d.hpp
bioinspired.hpp  features2d      line_descriptor      rgbd           surface_matching      ximgproc
calib3d          features2d.hpp  line_descriptor.hpp  rgbd.hpp       surface_matching.hpp  ximgproc.hpp
calib3d.hpp      flann           ml                   saliency       text                  xobjdetect.hpp
ccalib           flann.hpp       ml.hpp               saliency.hpp   text.hpp              xphoto
ccalib.hpp       fuzzy           objdetect            shape          tracking              xphoto.hpp
core             fuzzy.hpp       objdetect.hpp        shape.hpp      tracking.hpp
core.hpp         hdf             opencv.hpp           stereo         video
cvconfig.h       hdf.hpp         opencv_modules.hpp   stereo.hpp     video.hpp
datasets         highgui         optflow              stitching      videoio
dnn              highgui.hpp     optflow.hpp          stitching.hpp  videoio.hpp

我修改了关于我的Miniconda虚拟环境的Makfile.config:

 ANACONDA_HOME := $(HOME)/miniconda2
 PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
             $(ANACONDA_HOME)/include/python2.7 \
             $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \


INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial /home/pohsuan/miniconda2/envs/fastrcnn/include

LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /home/pohsuan/miniconda2/fastrcnn/lib

1 个答案:

答案 0 :(得分:1)

也许取消评论

 OPENCV_VERSION := 3 

在第21行,如果你还没有。 更糟糕的情况是,卸载OpenCV,并安装少于3的版本。

我为此苦苦挣扎,最后决定使用OpenCV 2.4.9.1,并且它有效。