OpenCV 3.4.1 build fails with Ubuntu 16.04

asked 2018-03-26 06:53:21 -0600

Idil gravatar image

updated 2018-03-26 06:56:47 -0600

Dear all, I am working with Ubuntu 16.04 LTS.
I have downloaded OpenCV3.4.1, and unzipped it into the Download folder. Following the instruction https://docs.opencv.org/2.4/doc/tutor..., I typed:

 apt update
    sudo apt-get install build-essential
    sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
    sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
    cd ~/opencv
    mkdir release
    cd release
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
    make

At this point I have a lot of errors, all related to protobuf. Below is a copy + paste of the first lines of errors:


   /home/elena/Downloads/opencv-3.4.1/3rdparty/protobuf/src/google/protobuf/arena.cc:76:45: error: ‘thread_cache’ was not declared in this scope
         InitBlock(initial_block_, &thread_cache(), options_.initial_block_size);
                                                 ^
    /home/elena/Downloads/opencv-3.4.1/3rdparty/protobuf/src/google/protobuf/arena.cc:76:48: error: ‘options_’ was not declared in this scope
     InitBlock(initial_block_, &thread_cache(), options_.initial_block_size);
                                                ^
/home/elena/Downloads/opencv-3.4.1/3rdparty/protobuf/src/google/protobuf/arena.cc:76:75: error: ‘InitBlock’ was not declared in this scope
     InitBlock(initial_block_, &thread_cache(), options_.initial_block_size);
                                             [ 17%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/google/protobuf/arena.cc.o

And this is the complete output of cmake:


elena@toshiba:~/Downloads/opencv-3.4.1/release$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
-- Looking for ccache - not found
-- Found ZLIB: /home/elena/anaconda3/lib/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Found ZLIB: /home/elena/anaconda3/lib/libz.so (found version "1.2.8") 
-- Checking for module 'gtk+-3.0'
--   No package 'gtk+-3.0' found
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'

--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'

--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found

-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- found Intel IPP (ICV version): 2017.0.3 [2017.0.3]
-- at: /home/elena/Downloads/opencv-3.4.1/release/3rdparty/ippicv/ippicv_lnx
-- found Intel IPP IW sources: 2017.0.3
-- at: /home/elena/Downloads/opencv-3.4.1/release/3rdparty/ippicv/ippiw_lnx
-- LAPACK(Atlas): LAPACK_LIBRARIES: /usr/lib/liblapack.so;/usr/lib/libcblas.so;/u

sr/lib/libatlas.so
-- LAPACK(Atlas): Support is enabled.
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT ...
(more)
edit retag flag offensive close merge delete

Comments

it looks like you're missing a lot of dependencies. Try another guide, such as here under Building OpenCV from source

dan01 gravatar imagedan01 ( 2018-03-26 07:28:04 -0600 )edit