Ask Your Question
0

How to build opencv 3.1 with CUDA 7.5 and contrib modules?

asked 2016-04-15 05:07:50 -0500

MrAI gravatar image

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:

  1. 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
  2. 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
  3. 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
  4. 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.

edit retag flag offensive close merge delete

Comments

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.

Tetragramm gravatar imageTetragramm ( 2016-04-15 20:31:55 -0500 )edit

By CMake errors I meant missing libs and such. Like when you add TBB and asks for it's location.

MrAI gravatar imageMrAI ( 2016-04-17 04:22:22 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2016-08-30 08:30:47 -0500

The first waning (LNK4044) is caused by an error on CMakeLists.txt of tag 3.1.0, as it is shown by this SO answer. As shown there, you can either change the following excerpt of CMakeLists.txt

foreach(p ${CUDA_LIBS_PATH})
  set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} -L${p})
endforeach()

to

foreach(p ${CUDA_LIBS_PATH})
  set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CMAKE_LIBRARY_PATH_FLAG}${p})
endforeach()

OR

Use a new version of the source code, as it has been fixed since the commit cb4818.

edit flag offensive delete link more
0

answered 2016-05-27 04:45:48 -0500

pool gravatar image

Hi Do not use cmake of rc version, it may cause unknown problem.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-04-15 05:07:50 -0500

Seen: 1,399 times

Last updated: Apr 15 '16