Ubuntu18.04安装g2o遇到的坑-TARGETS given no ARCHIVE DESTINATION for static library target

本文讲述了作者在使用深蓝学院多传感融合课程时遇到的g2o库安装错误,通过查找解决方案,发现是由于CMakeLists.txt中缺少安装路径设置,修正后的安装指南和备选方案,包括下载高博SLAM14课程的库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天跑深蓝学院多传感融合第四章作业时,发现没有安装g2o库,按照深蓝学院给的说明,安装此版本的g2o,发现报了以下错误。

CMake Error at core/CMakeLists.txt:49 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "core".
CMake Error at types/data/CMakeLists.txt:24 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_data".
CMake Error at types/slam2d/CMakeLists.txt:29 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_slam2d".
CMake Error at types/slam3d/CMakeLists.txt:52 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_slam3d".
CMake Error at types/sba/CMakeLists.txt:13 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_sba".
CMake Error at types/sim3/CMakeLists.txt:12 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_sim3".
CMake Error at types/icp/CMakeLists.txt:12 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_icp".
CMake Error at types/sclam2d/CMakeLists.txt:19 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_sclam2d".
CMake Error at types/slam2d_addons/CMakeLists.txt:24 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_slam2d_addons".
CMake Error at types/slam3d_addons/CMakeLists.txt:29 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "types_slam3d_addons".
CMake Error at solvers/pcg/CMakeLists.txt:14 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "solver_pcg".
CMake Error at solvers/dense/CMakeLists.txt:12 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "solver_dense".
CMake Error at solvers/structure_only/CMakeLists.txt:13 (install):
  install TARGETS given no ARCHIVE DESTINATION for static library target
  "solver_structure_only".
-- Configuring incomplete, errors occurred!
See also "/home/ysd/Downloads/g2o-20200410_git/g2o/build/CMakeFiles/CMakeOutput.log".

在网上找了很久,找到有人和我类似的问题:
g2o学习记录(3)源码下的example例子运行
然后根据错误提示,找到每个CMakelists.txt文件,将其中的:

  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}

修改为:

  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/static

其实这就是一个安装路径设置问题,原来的文件没有设置路径,所以需要自行设置。如果觉得修改麻烦,可以下载安装高博slam14讲的2017g2o 库

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值