簡體   English   中英

在Ubuntu 16.04上安裝OpenCV時出錯

[英]Error installing OpenCV on Ubuntu 16.04

我一直試圖在Ubuntu 16.04上安裝OpenCV unsing幾個教程,我總是最終得到一個錯誤。 這是我在本教程后面的最后一個:

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 `TIFFReadDirectory@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFIsTiled@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFReadTile@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `_TIFFfree@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFGetField@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFTileSize@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFClose@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFGetFieldDefaulted@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFNumberOfDirectories@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFOpen@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFReadRGBAImage@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFSetField@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `_TIFFmalloc@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFSetDirectory@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFReadScanline@LIBTIFF_4.0'
//usr/lib/x86_64-linux-gnu/libvtkIOImage-6.2.so.6.2: undefined reference to `TIFFNumberOfTiles@LIBTIFF_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

我按照相同的安裝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

然后繼續本教程。

根據這個 ,需要的OpenCV libtiff4 ,在Ubuntu中有所下降,即取代它的是包libtiff5-dev

作為臨時解決方法,您可以在配置時在cmake上指定-DBUILD_TIFF=ON ,以便構建隨OpenCV一起分發的libtiff4版本。

這對我來說在Ubuntu 16.04中使用OpenCV 3.2.1。

看起來你需要安裝/重新安裝libpng。

嘗試make clean ,然后再次執行make命令。 通常在一次失敗后,如果您在不清除早期安裝的情況下嘗試make命令,則會出現錯誤。

我有類似的問題。 我正在與opencv_contrib存儲庫一起構建openCV 3.3.0 事實證明,使用cmake命令包含標志-D BUILD_TIFF=ON解決了gevang已經指出的問題。

Ps。:由於我只承認gevang提供的解決方案,這應該是評論而不是答案,但我錯過了相應的權利。 對不起。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM