Ask Your Question

Revision history [back]

Build OpenCV 3.4 for python 3.6 on ubuntu

Lately, I have been contributing to opencv 3.4 branch. I am facing trouble building 3.4 branch locally, 4.2 is getting build successfully. Here is the status of my branches when I checkout master branch -

* master
  remotes/origin/2.4
  remotes/origin/3.4
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

I am using following command to cmake-

cd ~/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release \
 -D CMAKE_INSTALL_PREFIX=/usr/local \
 -D INSTALL_PYTHON_EXAMPLES=ON \
 -D INSTALL_C_EXAMPLES=OFF \
 -D OPENCV_ENABLE_NONFREE=ON \
 -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
 -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \
 -D BUILD_EXAMPLES=ON ..

when I try to build it on master branch it is successfully building but version 4.2.0 .I want to build 3.4 to test my changes made on child branch of 3.4 locally. I am getting the following error -

-

- Detected processor: x86_64
-- Looking for ccache - not found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
-- at: /home/ashish/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- found Intel IPP Integration Wrappers sources: 2020.0.0
-- at: /home/ashish/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- 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 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 Flake8 (missing: FLAKE8_EXECUTABLE) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
   calib3d
   core
 > cudaarithm
 > cudabgsegm

 > cudacodec
 > cudafeatures2d
 > cudafilters
 > cudaimgproc
 > cudalegacy
 > cudaobjdetect
 > cudaoptflow
 > cudastereo
 > cudawarping
 > cudev
   dnn
   features2d
   flann
   highgui
   imgcodecs
   imgproc
   java
   js
   ml
   objdetect
   photo
   python
 > shape
   stitching
 > superres
   ts
   video
   videoio
 > videostab
 > viz
   world
   aruco
   bgsegm
   bioinspired
   ccalib
   cnn_3dobj
 > cudaarithm
 > cudabgsegm
 > cudacodec
 > cudafeatures2d
 > cudafilters
 > cudaimgproc
 > cudalegacy
 > cudaobjdetect
 > cudaoptflow
 > cudastereo
 > cudawarping
 > cudev
   cvv
   datasets
   dnn_objdetect
   dnn_superres
   dpm
   face
   freetype
   fuzzy
   hdf
   hfs
   img_hash
   line_descriptor
   matlab
   optflow
   ovis
   phase_unwrapping
   plot
   quality
   rapid
   reg
   rgbd
   saliency
   sfm
 > shape
   stereo
   structured_light
 > superres
   surface_matching
   text
   tracking
 > videostab
 > viz
   xfeatures2d
   ximgproc
   xobjdetect
   xphoto
CMake Error at cmake/OpenCVModule.cmake:353 (message):
  Duplicated modules NAMES has been found
Call Stack (most recent call first):
  cmake/OpenCVModule.cmake:371 (_assert_uniqueness)
  modules/CMakeLists.txt:7 (ocv_glob_modules)


-- Configuring incomplete, errors occurred!
See also "/home/ashish/opencv/build/CMakeFiles/CMakeOutput.log".
See also "/home/ashish/opencv/build/CMakeFiles/CMakeError.log".

What should I do to build branch 3.4 so that I can work on child branch of 3.4 and build it to test locally.