3

我无法使用 cmake 构建支持 CUDA(版本 5)的 OpenCV 2.4.3 库。根据这里的另一个线程,问题似乎来自 nvcc:为什么 OpenCV 不能在 NVCC 中编译?. 但这并没有解释如何安装 OpenCV。

任何可以帮助我的答案将不胜感激!

我的系统设置:

Computer: Dell46 precision M4700 machine with Windows 7 professional, 64bit os 
Compiler: Microsoft Visual Studio 2008, 
CMake version: 2.8.10.2 
CUDA: 5.0

以下是我在 cmake 配置中设置“使用 Cuda”是时构建 Opencv 时的错误示例:

Error   3   fatal error : Option '--cubin (-cubin)' is not allowed when compiling for multiple GPU code instances   nvcc
Error   4   fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_core243.lib'  opencv_test_ml
Error   5   fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_core243.lib'  opencv_perf_video
Error   6   fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_core243.lib'  opencv_test_features2d
Error   7   fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_core243.lib'  opencv_perf_nonfree
Error   8   fatal error LNK1181: cannot open input file '..\..\lib\Release\opencv_core243.lib'  opencv_perf_photo
etc.
4

1 回答 1

2

:) Very happy to finally find the solution! As suggested by the first error shown above, -cubin is not allowed, so the solution is to remove this option. Step-by-step solution is:

  1. cmake-gui, select OpenCV source path and specify build path. Configure (check "with cuda"), Generate.
  2. Go to build path of opencv (you specified in cmake-gui), open CMakeCache.txt.
  3. Set CUDA_BUILD_CUBIN:BOOL to OFF as shown below:
  4. Build your opencv with VC++.

<CMakeCache.txt>: 
//Generate and parse .cubin files in Device mode.
CUDA_BUILD_CUBIN:BOOL=OFF

Good luck!

于 2013-01-05T23:10:38.720 回答