https://stackoverflow.com/questions/46584000/cmake-error-variables-are-set-to-notfound
I tried the following and it worked:
Change inFindCUDA.cmake
thenppi
library to the several splitted ones. This has to be done in 3 places. Remember this change is just to make it work with CUDA 9.0,I am not doing checks for version or anything,which should be done if you plan to give it to different people with different CUDA versions.
1) look for the line with:
find_cuda_helper_libs(nppi)
and replace it with the lines:
find_cuda_helper_libsnppial)nppiccnppicomnppideinppifnppignppimnppistnppisunppitc 2) find the line:setCUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}" and change it to"${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}"3) find the unset variables and add the new variables as well So,find:unsetCUDA_nppi_LIBRARY CACHE and change it to:CUDA_nppial_LIBRARY CACHEunsetCUDA_nppicc_LIBRARY CACHECUDA_nppicom_LIBRARY CACHECUDA_nppidei_LIBRARY CACHECUDA_nppif_LIBRARY CACHECUDA_nppig_LIBRARY CACHECUDA_nppim_LIBRARY CACHECUDA_nppist_LIBRARY CACHECUDA_nppisu_LIBRARY CACHECUDA_nppitc_LIBRARY CACHE And also inOpenCVDetectCUDA.cmake
you have to remove the 2.0 architechture which is no longer supported.It has:
... __cuda_arch_ptx ""ifCUDA_GENERATION STREQUAL "Fermi"__cuda_arch_bin "2.0" elseif"Kepler""3.0 3.5 3.7"...It should be:
"Maxwell""5.0 5.2" Basically I removed the first if and the first elif turns to an if.One last thing it is needed. CUDA 9.0 has a separated file for the halffloat (
cuda_fp16.h
) now. This needs to be included in OpenCV.From CUDA 9.0 manual:
Unsupported Features General CUDA ‣ CUDA library. The built-in functions __float2half_rn() and __half2float() have been removed. Use equivalent functionality in the updated fp16 header file from the CUDA toolkit.
To do this,you need to add:
#include <cuda_fp16.h>in the header file
opencv-3.3.0\modules\cudev\include\opencv2\cudev\common.hpp
This are the basics for a definite patch for OpenCV. What it is missing,well as I told you before,I do not care about CUDA versions (it needs an IF). Also,CUDA 9.0 has a bunch of deprecated functions used by OpenCV ... this probably will be replaced by the OpenCV team at some point. It is also possible that one or more of the splitted libraries of nppi is not used.
Final recommendations: For this kind of complex cmakes with so many options you should use ccmake (sudo apt-get install cmake-curses-gui
) to be able to change easily the variables or at least view the values,or a real GUI one.
For other people with windows and visual studio 7,I also had to change theCUDA_HOST_COMPILER
variable,else you get a bunch of errors withcmd.exe exit with code 1
or something similar... it seems it couldn't get there with the autodetected one.
This worked for me with OpenCV 3.3 and CUDA 9.0 and Visual Studio 2017 with Windows 10. I think it should work also in Ubuntu,since the error and the changes are related to CUDA. I haven't tested it much,I compiled and run the some of the performance tests and all of them passed... So I think everything worked ok.
==========================================================================================================================
open cmake-gui
remove 2.0 from CUDA_ARCH_BIN
enable ENABLE_CXX11
make sure BUILD_opencv_viz ticked
disable CUDA_PROPAGATE_HOST_FLAGS
add -std=c++11 --expt-relaxed-constexpr to CUDA_NVCC_FLAGS
modify opencv3/cmake/OpenCVDetectVTK.cmake,for every find_package(VTK QUIET COMPONENTS ... add an entry vtkIOGeometry
I suppose vtk has changed its structure in the new version,e.g. move vtkOBJReader into a sub library vtkIOGeometry,so you have to tell cmake to find vtkIOGeometry if you want to use that class.
Arch always uses the newest,that's why you'll encounter such issue earlier than others.
Looking for ccache - not found 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 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 'libv4l1' No package 'libv4l1' found Checking for module 'libv4l2' No package 'libv4l2' 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 CUDA detected: 9.0 CUDA NVCC target flags: -std=c++11 --expt-relaxed-constexpr;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30 Found VTK ver. 8.0.1 (usefile: /usr/local/lib/cmake/vtk-8.0/UseVTK.cmake) General configuration for OpenCV 2.4.13.4 ===================================== Version control: unknown Platform: Host: Linux 4.10.0-37-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): -std=c++11 -fsigned-char -W -Wall -Werror=return-type -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 -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG C++ flags (Debug): -std=c++11 -fsigned-char -W -Wall -Werror=return-type -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 -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG C Compiler: /usr/bin/cc C flags (Release): -fsigned-char -W -Wall -Werror=return-type -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 -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -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 -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG Linker flags (Release): Linker flags (Debug): ccache: NO Precompiled headers: YES OpenCV modules: To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab viz Disabled: world Disabled by dependency: - Unavailable: androidcamera dynamicuda java GUI: QT: NO GTK+ 2.x: YES (ver 2.24.30) GThread : YES (ver 2.48.2) GtkGlExt: NO OpenGL support: NO VTK support: YES (ver 8.0.1) 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 ) PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54) 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) Video I/O: DC1394 1.x: NO DC1394 2.x: YES (ver 2.2.4) FFMPEG: YES avcodec: YES (ver 57.107.100) avformat: YES (ver 57.83.100) avutil: YES (ver 55.78.100) swscale: YES (ver 4.8.100) avresample: NO GStreamer: NO OpenNI: NO OpenNI PrimeSensor Modules: NO PvAPI: NO GigEVisionSDK: NO UniCap: NO UniCap ucil: NO V4L/V4L2: NO/YES XIMEA: NO Xine: NO Other third-party libraries: Use IPP: NO Use Eigen: YES (ver 3.2.92) Use TBB: NO Use OpenMP: NO Use GCD NO Use Concurrency NO Use C=: NO Use Cuda: YES (ver 9.0) Use OpenCL: YES NVIDIA CUDA Use CUFFT: YES Use CUBLAS: NO USE NVCUVID: NO NVIDIA GPU arch: 30 35 NVIDIA PTX archs: 30 Use fast math: NO Tiny gpu module: NO OpenCL: Version: dynamic Include path: /home/seamanj/opencv-2.4.13.4/3rdparty/include/opencl/1.2 Use AMD FFT: NO Use AMD BLAS: NO Python: Interpreter: /usr/bin/python2 (ver 2.7.12) Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12) numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0) packages path: lib/python2.7/dist-packages Java: ant: NO JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include Java tests: NO Documentation: Build Documentation: NO Sphinx: NO PdfLaTeX compiler: /usr/bin/pdflatex Doxygen: YES (/usr/bin/doxygen) Tests and samples: Tests: YES Performance tests: YES C/C++ Examples: NO Install path: /usr/local cvconfig.h is in: /home/seamanj/opencv-2.4.13.4/build ----------------------------------------------------------------- CMake Warning at cmake/OpenCVPackaging.cmake:23 (message): CPACK_PACKAGE_VERSION does not match version provided by version.hpp header! Call Stack (most recent call first): CMakeLists.txt:1093 (include) Configuring done
using the following command to show the opencv version
pkg-config --modversion opencv