Kapil Gupta
Kapil Gupta

Reputation: 7741

Error using cmake

I had CUDA 7.5 installed before and have just removed it and installed CUDA 8.0. After doing that, cmake has started giving error on any kind of compilation , giving these errors:

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find CUDA: Found unsuitable version "8.0", but required is exact
  version "7.5" (found /usr/local/cuda-8.0)
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:386 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.5/Modules/FindCUDA.cmake:949 (find_package_handle_standard_args)
  /usr/local/share/OpenCV/OpenCVConfig.cmake:48 (find_package)
  /usr/local/share/OpenCV/OpenCVConfig.cmake:291 (find_host_package)
  CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/cortana/Desktop/app/build/CMakeFiles/CMakeOutput.log".
See also "/home/cortana/Desktop/app/build/CMakeFiles/CMakeError.log".

This error came up on compiling some opencv code. Considering that on not using cmake, the code compiles alright, opencv isn't broken. But cmake is showing such behaviour. Also, I am not even using cuda, so I dont know how its coming up. How can I remove this problem?

Edit: Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
PROJECT (app)
find_package(OpenCV REQUIRED )

set( SRC
    code.cpp
)


INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/include )
link_directories( ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
add_executable( {PROJECT_NAME} ${SRC} )

target_link_libraries( {PROJECT_NAME} ${OpenCV_LIBS} )

Upvotes: 1

Views: 1319

Answers (2)

Kapil Gupta
Kapil Gupta

Reputation: 7741

I was able to resolve my issue. Turns out that the v3.1 of opencv has just been updated to support CUDA 8.0. I rebuilt the latest source code and installed it which made the code start working again.

Upvotes: 2

Humam Helfawi
Humam Helfawi

Reputation: 20311

If you are sure that the code you are compiling is not using CUDA, just go to the file named CMakeLists.txt and delete anything related to CUDA like findPackage cuda or something similar. However, I doubt that someone will put this in CMakeLists.txt without the need of it.


After OP's edit:

it seems that the OpenCV version is configured with CUDA. If you want to get rid of it. use something similar to:

find_package(OpenCV COMPONENTS opencv_core opencv_highgui opencv_imgproc REQUIRED)

Ofcourse, add any other module you want.

Note: not tested.

Upvotes: 0

Related Questions