Win10+cuda9.0+tbb+cmake编译opencv3.1.0

  • 环境

Cuda9.0

opencv3.1.0(下载sources)

cmake3.12.2

tbb2019_20180718oss_win(下载链接:https://github.com/01org/tbb/releases

  • 编译

错误1: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)

解决方案:Cuda9.0存在兼容性问题,会报下面的错误,按照下面链接修改相关文件

https://blog.csdn.net/u014613745/article/details/78310916#reply

错误2:cmd.exe exit with code 1

解决方案:修改findcuda.cmake文件CMAKE_GENERATOR为自己安装vs对应cl.exe文件路径

if(CMAKE_GENERATOR MATCHES "Visual Studio")

set(CUDA_HOST_COMPILER "D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe" CACHE FILEPATH "Host side compiler used by NVCC")

错误3:unsupport “compute_20”

解决方案:

Cmake-gui双击修改CUDA_ARCH_BIN的value

错误4:

Win10+cuda9.0+tbb+cmake编译opencv3.1.0_第1张图片

解决方案:

将graphcuts.cpp文件中的声明

#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)

修改为

#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)

错误 5:

“std::tuple::tuple(const std::tuple &)”: 不是可默认为的特殊成员函数 (编译源文件 D:\opencv-3.1.0\modules\cudaimgproc\perf\perf_histogram.cpp)

解决方案:cmake-gui取消BUILD_PERF_TESTS

 

以上设置完成后,设置build和source路径,选择WITH_TBB,取消WITH_MATLAB,继续configure,configure完成后需要设置TBB头文件和lib路径,按照要求修改

再configure,没有错误直接generate,然后,点击open Project编译即可。

按照网上教程建议,优先编译moudles下面opencv_core, opencv_bioinspired, opencv_cudaarithm, opencv_cudabgsegm几个项目,然后编译install,一般情况下不会出错。

你可能感兴趣的:(cuda)