我最近升级到CUDA 6.5,并在Ubuntu 14.04上成功重新编译了OpenCV 2.4.9。
然而,当我使用OpenCV和cmake重新编译我的项目时,我收到以下配置错误:
-- GCC detected, adding compile flags
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find CUDA: Found unsuitable version "6.5", but required is exact
version "6.0" (found /usr/local/cuda-6.5)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:313 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindCUDA.cmake:806 (find_package_handle_standard_args)
/usr/local/share/OpenCV/OpenCVConfig.cmake:215 (find_package)
CMakeLists.txt:9 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/andrey/Data/Projects/Groups_code/Lulu/build-Ubuntu/CMakeFiles/CMakeOutput.log".
如何解决这个问题?我是否需要重新安装cmake,或者在cmake中升级模块文件?
答案 0 :(得分:1)
尝试删除cmake缓存。 “文件” - >“删除缓存”。然后像往常一样“配置”,“生成”。
答案 1 :(得分:1)
根据我的经验,当使用某个版本的CUDA构建OpenCV时,它会在文件/usr/local/share/OpenCV/OpenCVConfig.cmake
中指定。如果您在之后更改了CUDA 的版本,那么您构建了OpenCV,那么使用新的CUDA版本重建OpenCV应该可以解决这个问题。这基本上会将新版本重写为/usr/local/share/OpenCV/OpenCVConfig.cmake
。
此外,您似乎在致电find_package(CUDA)
后致电find_package(OpenCV)
。这会强制cmake查找构建OpenCV的CUDA版本。如果您在find_package(CUDA)
之前致电find_package(OpenCV)
,您可能会看到以下内容:
-- Found CUDA: /usr/local/cuda-6.5 (found version "6.5")
CMake Error at /usr/local/share/OpenCV/OpenCVConfig.cmake:222 (message):
OpenCV static library was compiled with CUDA 6.0 support. Please, use the
same version or rebuild OpenCV with CUDA 6.5
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
OpenCV源多年来一直在使用不同版本的CUDA进行更改,因此版本不匹配会导致事情中断。因此,建议的解决方法是重建OpenCV。