Building a non-CUDA application against CUDA enabled OpenCV?

asked 2018-03-05 17:57:04 -0600

I'm trying to build a statically linked library, with cmake, to run on a system without CUDA support. The system I'm building it on has CUDA, and OpenCV supports CUDA.

Do I need to link against OpenCV re-compiled without CUDA support, or is there another way?

edit retag flag offensive close merge delete

Comments

no, that should not be a problem. did you encounter any ?

berak gravatar imageberak ( 2018-03-06 00:14:37 -0600 )edit

Yep, a "CUDA version mismatch" that I don't want to resolve. OpenCV is 3.1 from Ubuntu package repository

From

find_package(OpenCV REQUIRED core )

we get

CMake Error at /usr/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find CUDA: Found unsuitable version "8.0", but required is exact
  version "7.5" (found /usr)
Call Stack (most recent call first):
... 1000 character limit ...
  /usr/local/share/OpenCV/OpenCVConfig.cmake:86 (find_host_package)
  CMakeLists.txt:5 (find_package)

Looking at OpenCVConfig.cmake, it seems to have a pretty unconditional dependency on CUDA

if(NOT CUDA_FOUND)
  find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
  ...check CUDA version and error if wrong version...
jnj16180340 gravatar imagejnj16180340 ( 2018-03-06 10:10:59 -0600 )edit

apologies, i misread it, did not see, that you're trying to use some prebuild libs.

if those were build against cuda, you need to have it on your system, else you cannopt use those.

but seriously, rather try to build latest 3.4.1 from src, than trying to mess with whatever outdated $@ยง ubuntu's package managers drag in..

berak gravatar imageberak ( 2018-03-06 10:55:20 -0600 )edit