2016-08-02 222 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工作。