The error:
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/onlineMIL.cpp.o
[ 58%] Linking CXX shared library ../../lib/libopencv_videostab.so
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerFeature.cpp.o
[ 58%] Built target opencv_videostab
[ 58%] Generating opencl_kernels_xfeatures2d.cpp, opencl_kernels_xfeatures2d.hpp
Scanning dependencies of target opencv_xfeatures2d
Scanning dependencies of target opencv_ximgproc
make[2]: * No rule to make target 'modules/ximgproc/CMakeFiles/opencv_ximgproc.dir/build'. Stop.
CMakeFiles/Makefile2:17890: recipe for target 'modules/ximgproc/CMakeFiles/opencv_ximgproc.dir/all' failed
make[1]: * [modules/ximgproc/CMakeFiles/opencv_ximgproc.dir/all] Error 2
make[1]: * Waiting for unfinished jobs....
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerBoosting.cpp.o
[ 58%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/msd.cpp.o
[ 58%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/boostdesc.cpp.o
[ 58%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/ellipticKeyPoint.cpp.o
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/tldUtils.cpp.o
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/onlineBoosting.cpp.o
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMIL.cpp.o
[ 58%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/brief.cpp.o
[ 58%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/feature.cpp.o
[ 58%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/xfeatures2d_init.cpp.o
[ 58%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/lucid.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/daisy.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/surf.ocl.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/stardetector.cpp.o
[ 59%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerBoostingModel.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/surf.cpp.o
[ 59%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerSamplerAlgorithm.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/vgg.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/affine_feature2d.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/pct_signatures_sqfd.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/pct_signatures.cpp.o
[ 59%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMILModel.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/latch.cpp.o
[ 59%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/multiTracker_alt.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/surf.cuda.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/pct_signatures/grayscale_bitmap.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/pct_signatures/pct_clusterizer.cpp.o
[ 59%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/src/trackerMedianFlow.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/pct_signatures /pct_sampler.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/harris_lapace_detector.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/sift.cpp.o
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/freak.cpp.o
[ 59%] Building CXX object modules/tracking/CMakeFiles/opencv_tracking.dir/opencl_kernels_tracking.cpp.o
[ 59%] Linking CXX shared library ../../lib/libopencv_tracking.so
[ 59%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/opencl_kernels_xfeatures2d.cpp.o
[ 59%] Built target opencv_tracking
[ 59%] Linking CXX shared library ../../lib/libopencv_xfeatures2d.so
[ 59%] Built target opencv_xfeatures2d
Makefile:160: recipe for target 'all' failed
make: * [all] Error 2
To reproduce:
$ cd ~/opencv-3.3.0/
$ 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_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \ -D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \ -D BUILD_EXAMPLES=ON ..
$ make -j4
cmake version 3.5.1
opencv-3.3.0
opencv_contrib-3.3.0
Operating System- Ubuntu 16.04