0

I tried to install opencv 3.1 to install Torch-opencv. However, the following error occurred while using the cmake. How can I fix this error?

My development environment uses Ubuntu 20.04 version through WSL2.

I've reinstalled all of my libraries and deleted and reinstalled them to prevent damage to my build files.

rm -rf build
❯ mkdir build
❯ cd build
❯ cmake -D CMAKE_BUILD_TYPE=RELEASE \
> -D CMAKE_INSTALL_PREFIX=/usr/local \
> -D WITH_TBB=ON \
> -D WITH_V4L=OFF \
> -D WITH_LIBV4L=ON \
> -D WITH_QT=ON \
> -D WITH_IPP=OFF \
> -D WITH_OPENGL=ON \
> -D WITH_CUDA=ON \
> -D WITH_1394=OFF \
> -D ENABLE_FAST_MATH=1 \
> -D CUDA_FAST_MATH=1 \
> -D CUDA_NVCC_FLAGS="-D_FORCE_INLINES" \
> -D BUILD_WITH_DEBUG_INFO=OFF \
> -D BUILD_DOCS=OFF \
> -D WITH_CUBLAS=1 \
> -D INSTALL_C_EXAMPLES=OFF \
> -D INSTALL_PYTHON_EXAMPLES=ON \
> -D BUILD_EXAMPLES=OFF \
> -D BUILD_TESTS=OFF \
> -D BUILD_PERF_TESTS=OFF \
> -D BUILD_OPENCV_PYTHON3=1 \
> -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
> -D WITH_FFMPEG=ON \
> -D WITH_XINE=ON \
> -D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
> -D PYTHON3_LIBRARIES=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
> -D BUILD_NEW_PYTHON_SUPPORT=ON \
> ../

CMake Deprecation Warning at CMakeLists.txt:72 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:77 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Deprecation Warning at CMakeLists.txt:82 (cmake_policy):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

...

-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
-- Performing Test HAVE_C_WMISSING_PROTOTYPES
-- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WUNDEF
-- Performing Test HAVE_CXX_WUNDEF - Success
-- Performing Test HAVE_C_WUNDEF
-- Performing Test HAVE_C_WUNDEF - Success
-- Performing Test HAVE_CXX_WINIT_SELF
-- Performing Test HAVE_CXX_WINIT_SELF - Success
-- Performing Test HAVE_C_WINIT_SELF
-- Performing Test HAVE_C_WINIT_SELF - Success
-- Performing Test HAVE_CXX_WPOINTER_ARITH
-- Performing Test HAVE_CXX_WPOINTER_ARITH - Success
-- Performing Test HAVE_C_WPOINTER_ARITH
-- Performing Test HAVE_C_WPOINTER_ARITH - Success
-- Performing Test HAVE_CXX_WSHADOW
-- Performing Test HAVE_CXX_WSHADOW - Success
-- Performing Test HAVE_C_WSHADOW
-- Performing Test HAVE_C_WSHADOW - Success
-- Performing Test HAVE_CXX_WSIGN_PROMO
-- Performing Test HAVE_CXX_WSIGN_PROMO - Success
-- Performing Test HAVE_C_WSIGN_PROMO
-- Performing Test HAVE_C_WSIGN_PROMO - Failed
-- Performing Test HAVE_CXX_WNO_NARROWING
-- Performing Test HAVE_CXX_WNO_NARROWING - Success
-- Performing Test HAVE_C_WNO_NARROWING
-- Performing Test HAVE_C_WNO_NARROWING - Success
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
-- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION
-- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success
-- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION
-- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success

...

-- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success
-- Performing Test HAVE_C_FVISIBILITY_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN
-- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
-- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.1.0")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Performing Test HAVE_C_WNO_UNUSED_VARIABLE
-- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success
-- Performing Test HAVE_C_WNO_UNUSED_FUNCTION
-- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success
-- Performing Test HAVE_C_WNO_SHADOW
-- Performing Test HAVE_C_WNO_SHADOW - Success
-- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED
-- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Success
-- Found Jasper: /usr/lib/x86_64-linux-gnu/libjasper.so (found version "1.900.1")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37")
-- Looking for /usr/include/libpng/png.h
-- Looking for /usr/include/libpng/png.h - found
-- Looking for semaphore.h
-- Looking for semaphore.h - found
-- Performing Test HAVE_CXX_WNO_SHADOW
-- Performing Test HAVE_CXX_WNO_SHADOW - Success
-- Performing Test HAVE_CXX_WNO_UNUSED
-- Performing Test HAVE_CXX_WNO_UNUSED - Success
-- Performing Test HAVE_CXX_WNO_SIGN_COMPARE
-- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success
-- Performing Test HAVE_CXX_WNO_UNDEF
-- Performing Test HAVE_CXX_WNO_UNDEF - Success
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WNO_UNINITIALIZED
-- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success
-- Performing Test HAVE_CXX_WNO_SWITCH
-- Performing Test HAVE_CXX_WNO_SWITCH - Success
-- Performing Test HAVE_CXX_WNO_PARENTHESES
-- Performing Test HAVE_CXX_WNO_PARENTHESES - Success
-- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS
-- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success
-- Performing Test HAVE_CXX_WNO_EXTRA
-- Performing Test HAVE_CXX_WNO_EXTRA - Success
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/FindOpenGL.cmake:275 (message):

...

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
    linked by target "opencv_cudev" in directory /home/boxboy/opencv/modules/cudev
    linked by target "opencv_cudev" in directory /home/boxboy/opencv/modules/cudev
    linked by target "opencv_core" in directory /home/boxboy/opencv/modules/core
    linked by target "opencv_core" in directory /home/boxboy/opencv/modules/core
    linked by target "opencv_cudaarithm" in directory /home/boxboy/opencv/modules/cudaarithm
    linked by target "opencv_cudaarithm" in directory /home/boxboy/opencv/modules/cudaarithm
    linked by target "opencv_flann" in directory /home/boxboy/opencv/modules/flann
    linked by target "opencv_flann" in directory /home/boxboy/opencv/modules/flann
    linked by target "opencv_hdf" in directory /home/boxboy/opencv_contrib/modules/hdf
    linked by target "opencv_hdf" in directory /home/boxboy/opencv_contrib/modules/hdf
    linked by target "opencv_imgproc" in directory /home/boxboy/opencv/modules/imgproc
    linked by target "opencv_imgproc" in directory /home/boxboy/opencv/modules/imgproc
    linked by target "opencv_ml" in directory /home/boxboy/opencv/modules/ml
    linked by target "opencv_ml" in directory /home/boxboy/opencv/modules/ml
    linked by target "opencv_reg" in directory /home/boxboy/opencv_contrib/modules/reg
    linked by target "opencv_reg" in directory /home/boxboy/opencv_contrib/modules/reg
    linked by target "opencv_surface_matching" in directory /home/boxboy/opencv_contrib/modules/surface_matching
    linked by target "opencv_surface_matching" in directory /home/boxboy/opencv_contrib/modules/surface_matching
    linked by target "opencv_video" in directory /home/boxboy/opencv/modules/video
    linked by target "opencv_video" in directory /home/boxboy/opencv/modules/video
    linked by target "opencv_cudabgsegm" in directory /home/boxboy/opencv/modules/cudabgsegm
    linked by target "opencv_cudabgsegm" in directory /home/boxboy/opencv/modules/cudabgsegm
    linked by target "opencv_cudafilters" in directory /home/boxboy/opencv/modules/cudafilters
    linked by target "opencv_cudafilters" in directory /home/boxboy/opencv/modules/cudafilters
    linked by target "opencv_cudaimgproc" in directory /home/boxboy/opencv/modules/cudaimgproc
    linked by target "opencv_cudaimgproc" in directory /home/boxboy/opencv/modules/cudaimgproc
    linked by target "opencv_cudawarping" in directory /home/boxboy/opencv/modules/cudawarping
    linked by target "opencv_cudawarping" in directory /home/boxboy/opencv/modules/cudawarping
    linked by target "opencv_dnn" in directory /home/boxboy/opencv_contrib/modules/dnn
    linked by target "opencv_dnn" in directory /home/boxboy/opencv_contrib/modules/dnn
    linked by target "opencv_fuzzy" in directory /home/boxboy/opencv_contrib/modules/fuzzy
    linked by target "opencv_fuzzy" in directory /home/boxboy/opencv_contrib/modules/fuzzy
    linked by target "opencv_imgcodecs" in directory /home/boxboy/opencv/modules/imgcodecs
    linked by target "opencv_imgcodecs" in directory /home/boxboy/opencv/modules/imgcodecs
    linked by target "opencv_photo" in directory /home/boxboy/opencv/modules/photo
    linked by target "opencv_photo" in directory /home/boxboy/opencv/modules/photo
    linked by target "opencv_shape" in directory /home/boxboy/opencv/modules/shape
    linked by target "opencv_shape" in directory /home/boxboy/opencv/modules/shape
    linked by target "opencv_videoio" in directory /home/boxboy/opencv/modules/videoio
    linked by target "opencv_videoio" in directory /home/boxboy/opencv/modules/videoio
    linked by target "opencv_cudacodec" in directory /home/boxboy/opencv/modules/cudacodec
    linked by target "opencv_cudacodec" in directory /home/boxboy/opencv/modules/cudacodec
    linked by target "opencv_highgui" in directory /home/boxboy/opencv/modules/highgui
    linked by target "opencv_highgui" in directory /home/boxboy/opencv/modules/highgui
    linked by target "opencv_objdetect" in directory /home/boxboy/opencv/modules/objdetect
    linked by target "opencv_objdetect" in directory /home/boxboy/opencv/modules/objdetect
    linked by target "opencv_plot" in directory /home/boxboy/opencv_contrib/modules/plot
    linked by target "opencv_plot" in directory /home/boxboy/opencv_contrib/modules/plot
    linked by target "opencv_xobjdetect" in directory /home/boxboy/opencv_contrib/modules/xobjdetect
    linked by target "opencv_xobjdetect" in directory /home/boxboy/opencv_contrib/modules/xobjdetect
    linked by target "opencv_xphoto" in directory /home/boxboy/opencv_contrib/modules/xphoto
    linked by target "opencv_xphoto" in directory /home/boxboy/opencv_contrib/modules/xphoto
    linked by target "opencv_bgsegm" in directory /home/boxboy/opencv_contrib/modules/bgsegm
    linked by target "opencv_bgsegm" in directory /home/boxboy/opencv_contrib/modules/bgsegm
    linked by target "opencv_bioinspired" in directory /home/boxboy/opencv_contrib/modules/bioinspired
    linked by target "opencv_bioinspired" in directory /home/boxboy/opencv_contrib/modules/bioinspired
    linked by target "opencv_dpm" in directory /home/boxboy/opencv_contrib/modules/dpm
    linked by target "opencv_dpm" in directory /home/boxboy/opencv_contrib/modules/dpm
    linked by target "opencv_face" in directory /home/boxboy/opencv_contrib/modules/face
    linked by target "opencv_face" in directory /home/boxboy/opencv_contrib/modules/face
    linked by target "opencv_features2d" in directory /home/boxboy/opencv/modules/features2d
    linked by target "opencv_features2d" in directory /home/boxboy/opencv/modules/features2d
    linked by target "opencv_line_descriptor" in directory /home/boxboy/opencv_contrib/modules/line_descriptor
    linked by target "opencv_line_descriptor" in directory /home/boxboy/opencv_contrib/modules/line_descriptor
    linked by target "opencv_saliency" in directory /home/boxboy/opencv_contrib/modules/saliency
    linked by target "opencv_saliency" in directory /home/boxboy/opencv_contrib/modules/saliency
    linked by target "opencv_text" in directory /home/boxboy/opencv_contrib/modules/text
    linked by target "opencv_text" in directory /home/boxboy/opencv_contrib/modules/text
    linked by target "opencv_calib3d" in directory /home/boxboy/opencv/modules/calib3d
    linked by target "opencv_calib3d" in directory /home/boxboy/opencv/modules/calib3d
    linked by target "opencv_ccalib" in directory /home/boxboy/opencv_contrib/modules/ccalib
    linked by target "opencv_ccalib" in directory /home/boxboy/opencv_contrib/modules/ccalib
    linked by target "opencv_cudafeatures2d" in directory /home/boxboy/opencv/modules/cudafeatures2d
    linked by target "opencv_cudafeatures2d" in directory /home/boxboy/opencv/modules/cudafeatures2d
    linked by target "opencv_cudalegacy" in directory /home/boxboy/opencv/modules/cudalegacy
    linked by target "opencv_cudalegacy" in directory /home/boxboy/opencv/modules/cudalegacy
    linked by target "opencv_cudaobjdetect" in directory /home/boxboy/opencv/modules/cudaobjdetect
    linked by target "opencv_cudaobjdetect" in directory /home/boxboy/opencv/modules/cudaobjdetect
    linked by target "opencv_cudaoptflow" in directory /home/boxboy/opencv/modules/cudaoptflow
    linked by target "opencv_cudaoptflow" in directory /home/boxboy/opencv/modules/cudaoptflow
    linked by target "opencv_cudastereo" in directory /home/boxboy/opencv/modules/cudastereo
    linked by target "opencv_cudastereo" in directory /home/boxboy/opencv/modules/cudastereo
    linked by target "opencv_cvv" in directory /home/boxboy/opencv_contrib/modules/cvv
    linked by target "opencv_cvv" in directory /home/boxboy/opencv_contrib/modules/cvv
    linked by target "opencv_datasets" in directory /home/boxboy/opencv_contrib/modules/datasets
    linked by target "opencv_datasets" in directory /home/boxboy/opencv_contrib/modules/datasets
    linked by target "opencv_rgbd" in directory /home/boxboy/opencv_contrib/modules/rgbd
    linked by target "opencv_rgbd" in directory /home/boxboy/opencv_contrib/modules/rgbd
    linked by target "opencv_stereo" in directory /home/boxboy/opencv_contrib/modules/stereo
    linked by target "opencv_stereo" in directory /home/boxboy/opencv_contrib/modules/stereo
    linked by target "opencv_structured_light" in directory /home/boxboy/opencv_contrib/modules/structured_light
    linked by target "opencv_structured_light" in directory /home/boxboy/opencv_contrib/modules/structured_light
    linked by target "opencv_superres" in directory /home/boxboy/opencv/modules/superres
    linked by target "opencv_superres" in directory /home/boxboy/opencv/modules/superres
    linked by target "opencv_tracking" in directory /home/boxboy/opencv_contrib/modules/tracking
    linked by target "opencv_tracking" in directory /home/boxboy/opencv_contrib/modules/tracking
    linked by target "opencv_videostab" in directory /home/boxboy/opencv/modules/videostab
    linked by target "opencv_videostab" in directory /home/boxboy/opencv/modules/videostab
    linked by target "opencv_xfeatures2d" in directory /home/boxboy/opencv_contrib/modules/xfeatures2d
    linked by target "opencv_xfeatures2d" in directory /home/boxboy/opencv_contrib/modules/xfeatures2d
    linked by target "opencv_ximgproc" in directory /home/boxboy/opencv_contrib/modules/ximgproc
    linked by target "opencv_ximgproc" in directory /home/boxboy/opencv_contrib/modules/ximgproc
    linked by target "opencv_aruco" in directory /home/boxboy/opencv_contrib/modules/aruco
    linked by target "opencv_aruco" in directory /home/boxboy/opencv_contrib/modules/aruco
    linked by target "opencv_optflow" in directory /home/boxboy/opencv_contrib/modules/optflow
    linked by target "opencv_optflow" in directory /home/boxboy/opencv_contrib/modules/optflow
    linked by target "opencv_sfm" in directory /home/boxboy/opencv_contrib/modules/sfm
    linked by target "opencv_sfm" in directory /home/boxboy/opencv_contrib/modules/sfm
    linked by target "opencv_stitching" in directory /home/boxboy/opencv/modules/stitching
    linked by target "opencv_stitching" in directory /home/boxboy/opencv/modules/stitching
    linked by target "opencv_traincascade" in directory /home/boxboy/opencv/apps/traincascade
    linked by target "opencv_createsamples" in directory /home/boxboy/opencv/apps/createsamples
    linked by target "opencv_annotation" in directory /home/boxboy/opencv/apps/annotation

-- Configuring incomplete, errors occurred!
See also "/home/boxboy/opencv/build/CMakeFiles/CMakeOutput.log".
  • 1
    Did you try the response suggested here? [CMake Error: Variables are set to NOTFOUND](https://stackoverflow.com/questions/46584000/cmake-error-variables-are-set-to-notfound) The error in the other post is **exactly the same** as yours, and the build situation appears to be similar. – Kevin Aug 08 '20 at 15:22
  • I'm wondering if you really need to build OpenCV 3.1 from source. [Ubuntu 20.04 comes with libopencv 4.2.0](https://packages.ubuntu.com/focal/libopencv-dev). – Martin Konrad Aug 08 '20 at 22:29

0 Answers0