slam相关-Sophus库cmake报错target "CUDA::cusolver" not found.

发布时间 2024-01-07 23:39:34作者: 摆科全书

报错细节

用cmake编译Sophus库时,有类似如下报错

CMake Error at test/core/CMakeLists.txt:18 (ADD_EXECUTABLE):
  Target "test_sim3" links to target "CUDA::cublas" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at test/core/CMakeLists.txt:18 (ADD_EXECUTABLE):
  Target "test_sim3" links to target "CUDA::cudart" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at test/core/CMakeLists.txt:18 (ADD_EXECUTABLE):
  Target "test_sim3" links to target "CUDA::cusolver" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at test/core/CMakeLists.txt:18 (ADD_EXECUTABLE):
  Target "test_sim3" links to target "CUDA::cusparse" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

问题定位

有多个target报错,都是这四个CUDA库链接问题,但我检查CUDA配置没有什么问题,最后发现是Eigen库路径问题。

原Eigen路径:/usr/include,需要是usr/local/include

遂参考这篇博客,删除原Eigen(其实不删除,把原来文件复制到新目录应该也行):
https://blog.csdn.net/weixin_44684139/article/details/104803225

然后clone下来Eigen库,老老实实编译,路径就是对的了,然后再去编译Sophus库时,就没有错了。