How to build opencv 3.1 with CUDA 7.5 and contrib modules?
System:
- Windows 8.1 Pro 64 bit
- Visual Studio 2013 Professional
- CUDA Toolkit 7.5 64 bit
- Newest version of OpenCV master and contrib source files from the official git repo
I read just about every tutorial on the subject, but they seem to be really out of date. The newest ones I could find where posted around 2014 for OpenCV 2.4. Even after reading all that was available, resolving all the errors that CMake made, there was not a single instance that Visual Studio would build OpenCV with CUDA. Without CUDA it will go trough, but the moment I add CUDA to the mix, the build fails every time.
All the error and warning types:
- Warning 2 warning LNK4044: unrecognized option '/LC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64'; ignored C:\Users\newba_000\Documents\OpenCVSources\OpenCV_built\modules\imgproc\LINK opencv_imgproc
- Error 3 error LNK1104: cannot open file '....\lib\Debug\opencv_core310d.lib' C:\Users\newba_000\Documents\OpenCVSources\OpenCV_built\modules\imgproc\LINK opencv_imgproc
- Error 1 error MSB6006: "cmd.exe" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 170 5 opencv_core
- Error 4 error MSB6006: "cmd.exe" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 170 5 opencv_cudaarithm
CUDA works for sure. Tested it with NVIDIA sample code and with some OpenCV functions using OpenCV Nuget package.
Errors with CMake? What sort? There should hopefully be no trouble at all. You simply install CUDA, point CMake at the OpenCV source, make sure the WITH_CUDA box is checked, and add the contrib modules to the CMake option for them.
If you're having errors in that process, that's likely where the problem comes from.
By CMake errors I meant missing libs and such. Like when you add TBB and asks for it's location.