2016-08-02 221 views
3

我一直在试图在Ubuntu 16.04上安装OpenCV,并解决了几个教程,而且我总是以一个错误结束。这是最后一个我已经得到了以下这个教程:在Ubuntu上安装OpenCV时出现错误16.04

https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-OpenCV-3.1-Installation-Guide

我能做些什么?

[ 48%] Linking CXX executable ../../bin/opencv_test_viz 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `[email protected]_4.0' 
collect2: error: ld returned 1 exit status 
modules/viz/CMakeFiles/opencv_test_viz.dir/build.make:236: recipe for target 'bin/opencv_test_viz' failed 
make[2]: *** [bin/opencv_test_viz] Error 1 
CMakeFiles/Makefile2:3306: recipe for target 'modules/viz/CMakeFiles/opencv_test_viz.dir/all' failed 
make[1]: *** [modules/viz/CMakeFiles/opencv_test_viz.dir/all] Error 2 
Makefile:160: recipe for target 'all' failed 
make: *** [all] Error 2 
+0

用于'标记图像文件格式'('TIFF')的库似乎缺失。您需要安装或验证是否安装了'libtiff5-dev'。如果'libtiff5-dev'不包含库,你还需要安装'libtiff5'。 – alvits

+0

您可能想尝试[install-opencv.sh脚本](http://milq.github.io/install-opencv-ubuntu-debian/)。它说它已经过Ubuntu 16.04的测试,如果你在里面看,你可以看到它正在安装的软件包(比如libpng-dev和libtiff5-dev)。 – unutbu

回答

6

我跟着安装opencv的相同教程,我有同样的问题。 这适用于我:

sudo apt-get autoremove libtiff5-dev 

sudo apt-get install libtiff5-dev 

输入opencv目录。

cd build/(我想这已经创建,否则创建)

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON .. 

make 

然后继续教程。

1

看起来你需要安装/重新安装libpng。

+0

我已经提升了我正在创建的错误。你可以再次检查一遍。我认为这与我使用libtiff5-dev的事实有关,它似乎期待着libtiff4-dev –

0

尝试make clean,然后再次执行make命令。通常,如果在不清除早期安装的情况下尝试执行make命令,则发生一次故障后会出现错误。

3

根据this,OpenCV需要Ubuntu已经放弃的libtiff4,即替换它的包为libtiff5-dev

作为临时解决方法,您可以在配置时在cmake上指定-DBUILD_TIFF=ON,以构建随OpenCV一起分发的libtiff4版本。

这在Ubuntu 16.04中用OpenCV 3.2.1工作。