Ask Your Question
0

CMake ${OpenCV_LIBS} corrupted

asked 2012-11-27 02:33:55 -0500

Dženan gravatar image

updated 2018-01-11 16:48:31 -0500

A simple CMake project produces corrupted libraries for linking. CMakeLists.txt:

cmake_minimum_required(VERSION 2.6)
PROJECT(bugTester CXX)

FIND_PACKAGE(OpenCV REQUIRED)
message("OpenCV_LIBS=${OpenCV_LIBS}")

ADD_EXECUTABLE(bugTester bugTester.cpp)
TARGET_LINK_LIBRARIES(bugTester ${OpenCV_LIBS})

When trying to generate the project files, I get this:

CMake Warning (dev) at CMakeLists.txt:7 (ADD_EXECUTABLE):
  Policy CMP0008 is not set: Libraries linked by full-path must have a valid
  library file name.  Run "cmake --help-policy CMP0008" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "bugTester" links to item

    C:/Program

  which is a full-path but not a valid library file name.
This warning is for project developers.  Use -Wno-dev to suppress it.

Generating done

The offending "C:/Program" can be easily tracked down to contents of ${OpenCV_LIBS} variable. Besides normal stuff, it also contains these:

C:/Program;
Files/NVIDIA;
GPU;
Computing;
Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
Toolkit/CUDA/v5.0/lib/x64/npp.lib;
Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

and those should be:

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cudart.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cuda.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/npp.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cufft.lib;
C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/lib/x64/cublas.lib;

It is obvious that spaces in library paths were incorrectly used to break libarary names.

Is there some fix or workaround for this? Would completely removing GPU modules from OpenCV configuration solve this?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2012-11-29 02:41:41 -0500

Dženan gravatar image

I have found a workaround. When configuring OpenCV, CMake configuration variables WITH_CUDA, WITH_CUBLAS and WITH_CUFFT should be unchecked (set to false). That way the offending libraries are not included at all.

The second option which worked for me was to use version 2.4.3 instead of 2.4.2, which worked also with CUDA included.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2012-11-27 02:33:55 -0500

Seen: 1,200 times

Last updated: Nov 29 '12