opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.44k stars 5.76k forks source link

opencv_contrib Install fail at 86% Generating Matlab source files / Permission Error #1206

Closed smmmmi closed 7 years ago

smmmmi commented 7 years ago

Building opencv-3.2.0 + opencv_contrib-3.2.0 on Ubuntu 16.4 Following this tutorial, after the 'make -j $(nproc)' on the 'sudo make install' step I get this permission error:

[ 86%] Generating Matlab source files
/bin/sh: 1: /home/mohammad/opencv/opencv_contrib-3.2.0/modules/matlab/generator/gen_matlab.py: Permission denied
modules/matlab/CMakeFiles/opencv_matlab_sources.dir/build.make:60: recipe for target 'modules/matlab/generate.proxy' failed
make[2]: *** [modules/matlab/generate.proxy] Error 126
CMakeFiles/Makefile2:25355: recipe for target 'modules/matlab/CMakeFiles/opencv_matlab_sources.dir/all' failed
make[1]: *** [modules/matlab/CMakeFiles/opencv_matlab_sources.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

The workaround to fix it was to manually go to the source folder (path/to/opencv_contrib-3.2.0/modules/matlab/generator/) and set execute permission for the .py files (gen_matlab.py and ...).

-- Detected version of GNU GCC: 54 (504)
-- FP16: Feature disabled
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
-- 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
-- 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 IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/mohammad/opencv/opencv-3.2.0/build/3rdparty/ippicv/ippicv_lnx
-- CUDA detected: 8.0
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing:  Atlas_CLAPACK_INCLUDE_DIR) 
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable exact version "2.7.12") 
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
but not all the files it references.

-- Found VTK ver. 6.2.0 (usefile: /usr/lib/cmake/vtk-6.2/UseVTK.cmake)
-- Caffe:   NO
-- Protobuf:   YES
-- Glog:   NO
-- freetype2:   YES
-- harfbuzz:    YES
-- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
-- freetype2:   YES
-- harfbuzz:    YES
-- Checking for modules 'tesseract;lept'
--   No package 'tesseract' found
--   No package 'lept' found
-- Tesseract:   NO
-- Check contents of vgg_generated_48.i ...
-- Check contents of vgg_generated_64.i ...
-- Check contents of vgg_generated_80.i ...
-- Check contents of vgg_generated_120.i ...
-- Check contents of boostdesc_bgm.i ...
-- Check contents of boostdesc_bgm_bi.i ...
-- Check contents of boostdesc_bgm_hd.i ...
-- Check contents of boostdesc_binboost_064.i ...
-- Check contents of boostdesc_binboost_128.i ...
-- Check contents of boostdesc_binboost_256.i ...
-- Check contents of boostdesc_lbgm.i ...
-- 
-- General configuration for OpenCV 3.2.0 =====================================
--   Version control:               unknown
-- 
--   Extra modules:
--     Location (extra):            /home/mohammad/opencv/opencv_contrib-3.2.0/modules
--     Version control (extra):     unknown
-- 
--   Platform:
--     Timestamp:                   2017-06-02T01:07:23Z
--     Host:                        Linux 4.8.0-53-generic x86_64
--     CMake:                       3.5.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 5.4.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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -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 -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -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 -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):
--     Linker flags (Debug):
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so gtk-3 gdk-3 pangocairo-1.0 pango-1.0 atk-1.0 cairo-gobject cairo gdk_pixbuf-2.0 gio-2.0 gobject-2.0 glib-2.0 gthread-2.0 gstbase-0.10 gstreamer-0.10 gmodule-2.0 xml2 gstvideo-0.10 gstapp-0.10 gstriff-0.10 gstpbutils-0.10 dc1394 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/x86_64-linux-gnu/libsz.so /usr/lib/x86_64-linux-gnu/libdl.so /usr/lib/x86_64-linux-gnu/libm.so vtkRenderingOpenGL vtkImagingHybrid vtkIOImage vtkCommonDataModel vtkCommonMath vtkCommonCore vtksys vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkDICOMParser vtkIOCore /usr/lib/x86_64-linux-gnu/libz.so vtkmetaio /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so vtkImagingCore vtkRenderingCore vtkCommonColor vtkFiltersExtraction vtkFiltersCore vtkFiltersGeneral vtkCommonComputationalGeometry vtkFiltersStatistics vtkImagingFourier vtkalglib vtkFiltersGeometry vtkFiltersSources vtkInteractionStyle vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOGeometry /usr/lib/x86_64-linux-gnu/libjsoncpp.so vtkFiltersTexture vtkRenderingFreeType /usr/lib/x86_64-linux-gnu/libfreetype.so vtkftgl vtkIOExport vtkRenderingAnnotation vtkImagingColor vtkRenderingContext2D vtkRenderingGL2PS vtkRenderingContextOpenGL /usr/lib/libgl2ps.so vtkRenderingLabel dl m pthread rt cudart nppc nppi npps cufft -L/usr/local/cuda/lib64
--     3rdparty dependencies:       libprotobuf
-- 
--   OpenCV modules:
--     To be built:                 cudev core cudaarithm flann hdf imgproc ml reg surface_matching video viz cudabgsegm cudafilters cudaimgproc cudawarping dnn freetype fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo datasets rgbd stereo superres tracking videostab xfeatures2d ximgproc aruco optflow phase_unwrapping stitching structured_light matlab python3
--     Disabled:                    world contrib_world
--     Disabled by dependency:      -
--     Unavailable:                 java python2 cnn_3dobj cvv sfm
-- 
--   GUI: 
--     QT:                          NO
--     GTK+ 3.x:                    YES (ver 3.18.9)
--     GThread :                    YES (ver 2.48.2)
--     GtkGlExt:                    NO
--     OpenGL support:              NO
--     VTK support:                 YES (ver 6.2.0)
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
--     WEBP:                        /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x0209)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.57)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
--     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
--     OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.2.0)
--     GDAL:                        NO
--     GDCM:                        NO
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.4)
--     FFMPEG:                      YES
--       avcodec:                   YES (ver 56.60.100)
--       avformat:                  YES (ver 56.40.101)
--       avutil:                    YES (ver 54.31.100)
--       swscale:                   YES (ver 3.1.101)
--       avresample:                NO
--     GStreamer:                   
--       base:                      YES (ver 0.10.36)
--       video:                     YES (ver 0.10.36)
--       app:                       YES (ver 0.10.36)
--       riff:                      YES (ver 0.10.36)
--       pbutils:                   YES (ver 0.10.36)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     Aravis SDK:                  NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    NO/YES
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO
-- 
--   Parallel framework:            pthreads
-- 
--   Other third-party libraries:
--     Use IPP:                     9.0.1 [9.0.1]
--          at:                     /home/mohammad/opencv/opencv-3.2.0/build/3rdparty/ippicv/ippicv_lnx
--     Use IPP Async:               NO
--     Use VA:                      NO
--     Use Intel VA-API/OpenCL:     NO
--     Use Lapack:                  NO
--     Use Eigen:                   YES (ver 3.2.92)
--     Use Cuda:                    YES (ver 8.0)
--     Use OpenCL:                  YES
--     Use OpenVX:                  NO
--     Use custom HAL:              NO
-- 
--   NVIDIA CUDA
--     Use CUFFT:                   YES
--     Use CUBLAS:                  NO
--     USE NVCUVID:                 NO
--     NVIDIA GPU arch:             20 30 35 37 50 52 60 61
--     NVIDIA PTX archs:
--     Use fast math:               NO
-- 
--   OpenCL:                        <Dynamic loading of OpenCL library>
--     Include path:                /home/mohammad/opencv/opencv-3.2.0/3rdparty/include/opencl/1.2
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
-- 
--   Python 2:
--     Interpreter:                 (ver 2.7.12)
-- 
--   Python 3:
--     Interpreter:                 /home/mohammad/.virtualenvs/cv/bin/python3 (ver 3.5.2)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
--     numpy:                       /home/mohammad/.virtualenvs/cv/local/lib/python3.5/site-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python3.5/site-packages
-- 
--   Python (for build):            
-- 
--   Java:
--     ant:                         NO
--     JNI:                         /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Matlab:
--     mex:                         /usr/local/MATLAB/R2014a/bin/mex
--     Compiler/generator:          Working
-- 
--   Documentation:
--     Doxygen:                     /usr/bin/doxygen (ver 1.8.11)
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              YES
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /home/mohammad/opencv/opencv-3.2.0/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mohammad/opencv/opencv-3.2.0/build

...
[ 85%] Generating precomp.hpp.gch/opencv_structured_light_RELEASE.gch
[ 85%] Built target pch_Generate_opencv_structured_light
[ 85%] Linking CXX shared library ../../lib/libopencv_structured_light.so
[ 85%] Built target opencv_structured_light
Scanning dependencies of target opencv_test_structured_light_pch_dephelp
[ 85%] Building CXX object modules/structured_light/CMakeFiles/opencv_test_structured_light_pch_dephelp.dir/opencv_test_structured_light_pch_dephelp.cxx.o
[ 85%] Linking CXX static library ../../lib/libopencv_test_structured_light_pch_dephelp.a
[ 85%] Built target opencv_test_structured_light_pch_dephelp
[ 85%] Generating test_precomp.hpp.gch/opencv_test_structured_light_RELEASE.gch
[ 85%] Built target pch_Generate_opencv_test_structured_light
[ 85%] Linking CXX executable ../../bin/opencv_test_structured_light
[ 85%] Built target opencv_test_structured_light
[ 85%] Linking CXX executable ../../bin/example_structured_light_cap_pattern
[ 85%] Built target example_structured_light_cap_pattern
[ 85%] Linking CXX executable ../../bin/example_structured_light_capsinpattern
[ 85%] Built target example_structured_light_capsinpattern
[ 86%] Linking CXX executable ../../bin/example_structured_light_projectorcalibration
[ 86%] Built target example_structured_light_projectorcalibration
[ 86%] Linking CXX executable ../../bin/example_structured_light_pointcloud
[ 86%] Built target example_structured_light_pointcloud
[ 86%] Generating Matlab source files
/bin/sh: 1: /home/mohammad/opencv/opencv_contrib-3.2.0/modules/matlab/generator/gen_matlab.py: Permission denied
modules/matlab/CMakeFiles/opencv_matlab_sources.dir/build.make:60: recipe for target 'modules/matlab/generate.proxy' failed
make[2]: *** [modules/matlab/generate.proxy] Error 126
CMakeFiles/Makefile2:25355: recipe for target 'modules/matlab/CMakeFiles/opencv_matlab_sources.dir/all' failed
make[1]: *** [modules/matlab/CMakeFiles/opencv_matlab_sources.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
alalek commented 7 years ago

Using sudo for build is not a good idea.

Matlab bindings generator uses python, but it is not found properly for some reason:

--   Python 2:
--     Interpreter:                 (ver 2.7.12)
-- 
--   Python 3:
--     Interpreter:                 /home/mohammad/.virtualenvs/cv/bin/python3 (ver 3.5.2)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
--     numpy:                       /home/mohammad/.virtualenvs/cv/local/lib/python3.5/site-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python3.5/site-packages
-- 
--   Python (for build):            

CMake log shows that CMake run is not "clean". Build should be run from scratch (from clean build directory) on large source code updates or on external changes (for example, after upgrading of system packages) - see "CMake cache" story.

ASavchenkov commented 7 years ago

Just had this exact same issue with a clean build directory. Definitely nothing to do with that. cmake log https://gist.github.com/ThaHypnotoad/51dbfe4eda668ab8f5741fae8af4e5b2 make install log https://gist.github.com/ThaHypnotoad/04362981595a07cd4b02b15400f4d5a6

please reopen.