在 ubuntu 14.04 上安装 opencv 时出错

Posted

技术标签:

【中文标题】在 ubuntu 14.04 上安装 opencv 时出错【英文标题】:error when installing opencv on ubuntu 14.04 【发布时间】:2015-10-07 15:39:54 【问题描述】:
[  1%] [  1%] [  1%] [  1%] Built target opencv_hal_pch_dephelp
Built target opencv_core_pch_dephelp
Built target opencv_ts_pch_dephelp
Built target opencv_imgproc_pch_dephelp
[  1%] Built target opencv_imgcodecs_pch_dephelp
[  2%] [  7%] Built target opencv_highgui_pch_dephelp
Built target libwebp
[  7%] [  7%] Built target opencv_videoio_pch_dephelp
Built target opencv_perf_core_pch_dephelp
[  7%] [  7%] [  9%] Built target opencv_flann_pch_dephelp
[ 10%] Built target opencv_test_core_pch_dephelp
Built target opencv_test_flann_pch_dephelp
Built target opencv_perf_imgproc_pch_dephelp
[ 10%] [ 10%] Built target opencv_test_imgproc_pch_dephelp
Built target opencv_ml_pch_dephelp
[ 11%] [ 11%] [ 13%] [ 13%] Built target opencv_perf_photo_pch_dephelp
[ 13%] Built target opencv_test_ml_pch_dephelp
Built target opencv_photo_pch_dephelp
Built target opencv_test_photo_pch_dephelp
[ 13%] [ 13%] Built target opencv_test_video_pch_dephelp
Built target opencv_perf_imgcodecs_pch_dephelp
[ 14%] Built target opencv_video_pch_dephelp
Built target opencv_perf_video_pch_dephelp
[ 14%] Built target opencv_test_imgcodecs_pch_dephelp
[ 14%] Built target opencv_shape_pch_dephelp
[ 14%] [ 14%] [ 14%] Built target opencv_perf_videoio_pch_dephelp
Built target opencv_test_videoio_pch_dephelp
Built target opencv_test_highgui_pch_dephelp
[ 15%] [ 17%] Built target opencv_test_shape_pch_dephelp
Built target opencv_objdetect_pch_dephelp
[ 17%] [ 17%] Built target opencv_perf_objdetect_pch_dephelp
Built target opencv_test_objdetect_pch_dephelp
[ 17%] [ 18%] Built target opencv_superres_pch_dephelp
[ 19%] Built target opencv_perf_superres_pch_dephelp
Built target opencv_test_superres_pch_dephelp
[ 19%] Built target opencv_features2d_pch_dephelp
[ 19%] Built target opencv_perf_features2d_pch_dephelp
[ 19%] [ 19%] [ 19%] [ 19%] Built target opencv_test_features2d_pch_dephelp
Built target opencv_calib3d_pch_dephelp
[ 21%] [ 21%] [ 21%] Built target opencv_perf_calib3d_pch_dephelp
Built target opencv_test_calib3d_pch_dephelp
Built target opencv_perf_stitching_pch_dephelp
Built target opencv_stitching_pch_dephelp
Built target opencv_test_stitching_pch_dephelp
[ 22%] [ 22%] [ 22%] [ 22%] [ 22%] [ 22%] [ 23%] Built target pch_Generate_opencv_core
Built target opencv_videostab_pch_dephelp
Built target pch_Generate_opencv_ts
Built target pch_Generate_opencv_hal
Built target pch_Generate_opencv_imgproc
Built target pch_Generate_opencv_imgcodecs
Built target pch_Generate_opencv_highgui
[ 23%] Built target pch_Generate_opencv_videoio
[ 23%] [ 23%] Built target pch_Generate_opencv_perf_core
Built target pch_Generate_opencv_test_core
[ 25%] Built target pch_Generate_opencv_test_flann
[ 25%] [ 25%] Built target pch_Generate_opencv_flann
[ 25%] [ 25%] Built target pch_Generate_opencv_perf_imgproc
Built target pch_Generate_opencv_ml
Built target pch_Generate_opencv_test_imgproc
[ 25%] Built target pch_Generate_opencv_test_ml
[ 25%] [ 25%] [ 25%] Built target pch_Generate_opencv_photo
Built target pch_Generate_opencv_perf_photo
Built target pch_Generate_opencv_test_photo
[ 25%] [ 25%] [ 26%] Built target pch_Generate_opencv_video
Built target pch_Generate_opencv_perf_video
Built target pch_Generate_opencv_test_video
[ 26%] [ 26%] Built target pch_Generate_opencv_perf_imgcodecs
Built target pch_Generate_opencv_test_imgcodecs
[ 26%] [ 27%] [ 27%] [ 27%] Built target pch_Generate_opencv_shape
Built target pch_Generate_opencv_test_shape
Built target pch_Generate_opencv_test_videoio
Built target pch_Generate_opencv_test_highgui
[ 27%] Built target pch_Generate_opencv_perf_videoio
[ 27%] [ 27%] [ 28%] Built target pch_Generate_opencv_objdetect
Built target pch_Generate_opencv_perf_objdetect
Built target pch_Generate_opencv_test_objdetect
[ 28%] [ 28%] [ 28%] Built target pch_Generate_opencv_superres
Built target pch_Generate_opencv_perf_superres
Built target pch_Generate_opencv_features2d
[ 28%] Built target pch_Generate_opencv_test_superres
[ 30%] Built target pch_Generate_opencv_perf_features2d
[ 30%] [ 30%] Built target pch_Generate_opencv_test_features2d
Built target pch_Generate_opencv_calib3d
[ 30%] [ 30%] [ 31%] [ 31%] Built target pch_Generate_opencv_perf_calib3d
[ 31%] [ 32%] Built target pch_Generate_opencv_test_calib3d
Built target pch_Generate_opencv_perf_stitching
Built target pch_Generate_opencv_test_stitching
Built target pch_Generate_opencv_stitching
Built target pch_Generate_opencv_videostab
[ 34%] Built target opencv_hal
[ 39%] Built target opencv_core
[ 40%] Built target opencv_flann
[ 42%] Built target opencv_ml
[ 48%] Built target opencv_imgproc
[ 51%] [ 52%] Built target opencv_photo
Built target opencv_video
[ 55%] Built target opencv_imgcodecs
[ 56%] Built target opencv_shape
[ 57%] Built target opencv_videoio
[ 57%] Built target opencv_superres
[ 57%] Built target opencv_highgui
[ 57%] Built target opencv_annotation
[ 59%] [ 60%] Built target opencv_objdetect
Built target opencv_ts
[ 63%] Built target opencv_features2d
[ 67%] [ 67%] Built target opencv_perf_core
[ 67%] Built target opencv_test_flann
Built target opencv_test_ml
[ 71%] [ 71%] Built target opencv_test_core
[ 75%] Built target opencv_perf_photo
[ 81%] Built target opencv_perf_imgproc
Built target opencv_test_imgproc
Linking CXX executable ../../bin/opencv_perf_video
[ 81%] [ 81%] Linking CXX executable ../../bin/opencv_perf_videoio
[ 82%] Built target opencv_perf_imgcodecs
Linking CXX executable ../../bin/opencv_test_video
Linking CXX executable ../../bin/opencv_test_videoio
[ 82%] Built target opencv_test_imgcodecs
Built target opencv_test_photo
Built target opencv_test_shape
[ 82%] Built target opencv_perf_objdetect
[ 82%] Linking CXX executable ../../bin/opencv_perf_superres
[ 82%] Built target opencv_test_objdetect
Built target opencv_test_highgui
Linking CXX executable ../../bin/opencv_test_superres
[ 84%] Built target opencv_perf_features2d
Scanning dependencies of target opencv_test_features2d
[ 86%] Built target opencv_calib3d
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `gst_app_sink_pull_sample'
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `gst_app_sink_pull_sample'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_test_videoio] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_test_videoio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [bin/opencv_test_video] Error 1
make[1]: *** [modules/video/CMakeFiles/opencv_test_video.dir/all] Error 2
[ 86%] [ 86%] ../../lib/libopencv_videoio.so.3.0.0: undefined reference to `gst_app_sink_pull_sample'
collect2: error: ld returned 1 exit status
Scanning dependencies of target opencv_perf_calib3d
make[2]: *** [bin/opencv_perf_videoio] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_perf_videoio.dir/all] Error 2
Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_main.cpp.o
Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_keypoints.cpp.o
[ 86%] [ 86%] ../../lib/libopencv_videoio.so.3.0.0: undefined reference to `gst_app_sink_pull_sample'
Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_nearestneighbors.cpp.o
collect2: error: ld returned 1 exit status
make[2]: Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_fast.cpp.o
*** [bin/opencv_perf_video] Error 1
make[1]: *** [modules/video/CMakeFiles/opencv_perf_video.dir/all] Error 2
[ 86%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_orb.cpp.o
../../lib/libopencv_videoio.so.3.0.0: undefined reference to `gst_app_sink_pull_sample'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_superres] Error 1
make[1]: *** [modules/superres/CMakeFiles/opencv_perf_superres.dir/all] Error 2
[ 86%] ../../lib/libopencv_videoio.so.3.0.0: undefined reference to `gst_app_sink_pull_sample'
collect2: error: ld returned 1 exit status
Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_detectors_regression.cpp.o
make[2]: *** [bin/opencv_test_superres] Error 1
make[1]: *** [modules/superres/CMakeFiles/opencv_test_superres.dir/all] Error 2
[ 86%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_rotation_and_scale_invariance.cpp.o
[ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_perf_calib3d.dir/perf/opencl/perf_stereobm.cpp.o
[ 86%] Building CXX object modules/calib3d/CMakeFiles/opencv_perf_calib3d.dir/perf/perf_pnp.cpp.o
[ 88%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_agast.cpp.o
[ 88%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_mser.cpp.o
[ 88%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_brisk.cpp.o
[ 88%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_descriptors_regression.cpp.o
[ 88%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/ocl/test_brute_force_matcher.cpp.o
[ 88%] Building CXX object modules/features2d/CMakeFiles/opencv_test_features2d.dir/test/test_matchers_algorithmic.cpp.o
[ 88%] [ 88%] Building CXX object modules/calib3d/CMakeFiles/opencv_perf_calib3d.dir/perf/perf_main.cpp.o
Building CXX object modules/calib3d/CMakeFiles/opencv_perf_calib3d.dir/perf/perf_cicrlesGrid.cpp.o
Linking CXX executable ../../bin/opencv_test_features2d
[ 88%] Built target opencv_test_features2d
Linking CXX executable ../../bin/opencv_perf_calib3d
[ 88%] Built target opencv_perf_calib3d
make: *** [all] Error 2

在我输入之后 使-j8 顺便说一句。我使用的是 Ubuntu 14.04。 我想在我的笔记本电脑上安装 opencv-3.0.0 我已经谷歌了这个问题,但我没有找到任何有用的信息。 如果有人能帮助我,我将不胜感激!

【问题讨论】:

【参考方案1】:

首先尝试通过安装libgstreamer-plugins-base1.0-dev 来修复错误。 但是,如果您仍然遇到错误,我建议您在没有 gstreamer 支持的情况下构建 OpenCV。即设置WITH_GSTREAMER=OFF

【讨论】:

【参考方案2】:

我在构建 opencv 3.3 时遇到了同样的问题。我发现配置是gstreamer 0.10gstreamer 1.0 的混合。所以,我通过删除旧版本的 gstreamer 来修复错误。

sudo apt-get remove libgstreamer0.10-dev

希望对你有帮助。

【讨论】:

您可以根据自己的喜好使用“-D WITH_GSTREAMER_0_10=OFF”或 ON 作为 cmake 的参数来选择 gstreamer 1 或 0。

以上是关于在 ubuntu 14.04 上安装 opencv 时出错的主要内容,如果未能解决你的问题,请参考以下文章

转载:Ubuntu14.04与opencv2.4.8opencv3.0版本共存

ubuntu14.04+OpenCV2.4.9+java+Eclipse安装配置

ubuntu14.04+OpenCV2.4.9+java+Eclipse安装配置

ubuntu 14.04 下利用apt-get方式安装opencv

ubuntu14.04 PCL1.8 OPENNI2.0 OPENCV3.0安装小结

ubuntu 14.04 下利用apt-get方式安装opencv