I'm trying to build openCV on Raspberry Pi, following the instructions at https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/ .
After installing all dependencies, I'm running:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
Which gives me the following output on stdout:
-- Looking for ccache - not found -- FP16 is not supported by C++ compiler -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8") -- 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 -- Checking for module 'libdc1394-2' -- No package 'libdc1394-2' found -- Checking for module 'libdc1394' -- No package 'libdc1394' 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 -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR) -- A library with BLAS API found. -- A library with LAPACK API found. -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) -- Could NOT find Pylint (missing: PYLINT_EXECUTABLE) -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file CMake Error at cmake/OpenCVModule.cmake:300 (message): No extra modules found in folder: /home/pi/opencv_contrib/modules Please provide path to 'opencv_contrib/modules' folder. Call Stack (most recent call first): modules/CMakeLists.txt:7 (ocv_glob_modules) -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/core/src/convert.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/core/src/convert.fp16.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/core/src/convert.sse4_1.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/core/mathfuncs_core.sse2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/core/mathfuncs_core.avx.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/core/mathfuncs_core.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/core/stat.sse4_2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/core/stat.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/core/test/test_intrin.fp16.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/corner.avx.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/filter.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/imgwarp.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/imgwarp.sse4_1.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/resize.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/resize.sse4_1.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/imgproc/src/undistort.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/imgproc/accum.sse2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/imgproc/accum.avx.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/imgproc/accum.neon.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/objdetect/src/haar.avx.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/dnn/layers/layers_common.avx.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/build/modules/dnn/layers/layers_common.avx2.cpp -- Excluding from source files list: /home/pi/opencv-3.4.0/modules/features2d/src/fast.avx2.cpp -- DNN_FACE_DETECTOR: Download: res10_300x300_ssd_iter_140000.caffemodel -- -- General configuration for OpenCV 3.4.0 ===================================== -- Version control: unknown -- -- Platform: -- Timestamp: 2018-02-26T01:35:42Z -- Host: Linux 4.14.21-v7+ armv7l -- CMake: 3.7.2 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make -- Configuration: RELEASE -- -- CPU/HW features: -- Baseline: -- requested: DETECT -- disabled: VFPV3 NEON -- -- C/C++: -- Built as dynamic libs?: YES -- C++11: YES -- C++ Compiler: /usr/bin/c++ (ver 6.3.0) -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- ccache: NO -- Precompiled headers: YES -- Extra dependencies: dl m pthread rt -- 3rdparty dependencies: -- -- OpenCV modules: -- To be built: calib3d core dnn features2d flann highgui imgcodecs imgproc ml objdetect photo python2 python3 python_bindings_generator shape stitching superres ts video videoio videostab -- Disabled: js world -- Disabled by dependency: - -- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java viz -- Applications: tests perf_tests examples apps -- Documentation: NO -- Non-free algorithms: NO -- -- GUI: -- GTK+: YES (ver 3.22.11) -- GThread : YES (ver 2.50.3) -- GtkGlExt: NO -- VTK support: NO -- -- Media I/O: -- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8) -- JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver ) -- WEBP: build (ver encoder: 0x020e) -- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28) -- TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8) -- JPEG 2000: /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1) -- OpenEXR: build (ver 1.7.1) -- -- Video I/O: -- DC1394: NO -- FFMPEG: YES -- avcodec: YES (ver 57.64.101) -- avformat: YES (ver 57.56.101) -- avutil: YES (ver 55.34.101) -- swscale: YES (ver 4.2.100) -- avresample: NO -- GStreamer: NO -- libv4l/libv4l2: NO -- v4l/v4l2: linux/videodev2.h -- gPhoto2: NO -- -- Parallel framework: pthreads -- -- Trace: YES (built-in) -- -- Other third-party libraries: -- Lapack: NO -- Eigen: NO -- Custom HAL: YES (carotene (ver 0.0.1)) -- -- NVIDIA CUDA: NO -- -- OpenCL: YES (no extra features) -- Include path: /home/pi/opencv-3.4.0/3rdparty/include/opencl/1.2 -- Link libraries: Dynamic load -- -- Python 2: -- Interpreter: /usr/bin/python2.7 (ver 2.7.13) -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13) -- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.14.1) -- packages path: lib/python2.7/dist-packages -- -- Python 3: -- Interpreter: /usr/bin/python3 (ver 3.5.3) -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3) -- numpy: /usr/local/lib/python3.5/dist-packages/numpy/core/include (ver 1.14.1) -- packages path: lib/python3.5/dist-packages -- -- Python (for build): /usr/bin/python2.7 -- -- Java: -- ant: NO -- JNI: NO -- Java wrappers: NO -- Java tests: NO -- -- Matlab: NO -- -- Install to: /usr/local -- ----------------------------------------------------------------- -- -- Configuring incomplete, errors occurred! See also "/home/pi/opencv-3.4.0/build/CMakeFiles/CMakeOutput.log". See also "/home/pi/opencv-3.4.0/build/CMakeFiles/CMakeError.log".
The actual contents of /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeError.log are:
Determining if the include file linux/videodev.h exists failed with the following output: Change Dir: /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTC_9c20f/fast" /usr/bin/make -f CMakeFiles/cmTC_9c20f.dir/build.make CMakeFiles/cmTC_9c20f.dir/build make[1]: Entering directory '/home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_9c20f.dir/CheckIncludeFile.c.o /usr/bin/cc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_9c20f.dir/CheckIncludeFile.c.o -c /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:28: fatal error: linux/videodev.h: No such file or directory #include <linux videodev.h=""> ^ compilation terminated. CMakeFiles/cmTC_9c20f.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_9c20f.dir/CheckIncludeFile.c.o' failed make[1]: *** [CMakeFiles/cmTC_9c20f.dir/CheckIncludeFile.c.o] Error 1 make[1]: Leaving directory '/home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_9c20f/fast' failed make: *** [cmTC_9c20f/fast] Error 2 Determining if the include file sys/videoio.h exists failed with the following output: Change Dir: /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/make" "cmTC_19556/fast" /usr/bin/make -f CMakeFiles/cmTC_19556.dir/build.make CMakeFiles/cmTC_19556.dir/build make[1]: Entering directory '/home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_19556.dir/CheckIncludeFile.c.o /usr/bin/cc -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -fvisibility=hidden -O3 -DNDEBUG -fPIE -o CMakeFiles/cmTC_19556.dir/CheckIncludeFile.c.o -c /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c /home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:25: fatal error: sys/videoio.h: No such file or directory #include <sys videoio.h=""> ^ compilation terminated. CMakeFiles/cmTC_19556.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_19556.dir/CheckIncludeFile.c.o' failed make[1]: *** [CMakeFiles/cmTC_19556.dir/CheckIncludeFile.c.o] Error 1 make[1]: Leaving directory '/home/pi/opencv-3.4.0/build/CMakeFiles/CMakeTmp' Makefile:126: recipe for target 'cmTC_19556/fast' failed make: *** [cmTC_19556/fast] Error 2
Can anyone help me understand why this is failing? I'm pretty new to OpenCV and CMake, so not sure what I'm doing wrong, or how to fix it...