1、问题
编译安装 GCNv2_SLAM
过程中,在运行项目下 build.sh
文件中 cmake .. -DCMAKE_BUILD_TYPE=Release -DTORCH_PATH=xxx
这一步时,发生如下报错:
CMake Error at CMakeLists.txt:101 (add_executable):
Target "rgbd_gcn" links to target "Eigen3::Eigen" 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 CMakeLists.txt:101 (add_executable):
Target "rgbd_gcn" links to target "Eigen3::Eigen" 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 CMakeLists.txt:67 (add_library):
Target "ORB_SLAM2" links to target "Eigen3::Eigen" 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 CMakeLists.txt:67 (add_library):
Target "ORB_SLAM2" links to target "Eigen3::Eigen" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
2、排查
- 根据以上报错提示判断,应该是
cmake
编译时没找到eigen
库。 - 但是其他项目编译时可以正常使用
eigen
库,所以不是库没装的问题。 - 看到项目目录下有
cmake_modules/FindEigen3.cmake
这一文件,参考了别人的博客,这一文件是给cmake
在find_package(Eigen3 ...)
时提供额外帮助的。- ubunutu eigen3包的查找: https://www.cnblogs.com/flyinggod/p/12469713.html
- 所以其他项目不使用
FindEigen3.cmake
可以正常找到eigen
库,GCNv2_SLAM
用了反而没办法找到eigen
库。
3、解决
- 在
CMakeLists.txt
文件中注释对FindEigen3.cmake
的使用,即注释这一行:
# LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
- 然后重新编译(记得先删除旧的
build
文件夹),就可以编译成功了。