lego-loam运行常见错误

记录编译和运行过程中的错误,真的是心态崩阿


前言

下载好lego—loam后在工作空间上打开终端catkin_make编译出现以下几个错误:


一、CMake Error at /usr/local/lib/cmake/GTSAM/GTSAM-exports.cmake:100 (message):

-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at /usr/local/lib/cmake/GTSAM/GTSAM-exports.cmake:100 (message):
  The imported target "metis" references the file

     "/usr/local/lib/libmetis.so"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/local/lib/cmake/GTSAM/GTSAM-exports.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake:20 (include)
  LeGO-LOAM/LeGO-LOAM/CMakeLists.txt:23 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/robot/robot_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/robot/robot_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

解决方法1:

gedit /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake

这个方法只能是只读模式,无法进行修改,所以要采取下面这个方法

cd  /usr/local/lib/cmake/GTSAM/
sudo chmod a+w GTSAMConfig.cmake
gedit GTSAMConfig.cmake 

将/usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake:20行的include改成find_package,GTSAMConfig.cmake里面的代码如下:

# - Config file for GTSAM
# It defines the following variables
#  GTSAM_INCLUDE_DIR - include directories for GTSAM

# Compute paths
get_filename_component(OUR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS "${OUR_CMAKE_DIR}/CMakeCache.txt")
  # In build tree
  set(GTSAM_INCLUDE_DIR /home/robot/gtsam CACHE PATH "GTSAM include directory")
else()
  # Find installed library
  set(GTSAM_INCLUDE_DIR "${OUR_CMAKE_DIR}/../../../include" CACHE PATH "GTSAM include directory")
endif()

# Find dependencies, required by cmake exported targets:
include(CMakeFindDependencyMacro)
find_dependency(Boost 1.43 COMPONENTS serialization;system;filesystem;thread;program_options;date_time;timer;chrono;regex)

# Load exports
find_package(${OUR_CMAKE_DIR}/GTSAM-exports.cmake)

# Load project-specific flags, if present
if(EXISTS "${OUR_CMAKE_DIR}/gtsam_extra.cmake")
	include("${OUR_CMAKE_DIR}/gtsam_extra.cmake")
endif()

message(STATUS "GTSAM include directory:  ${GTSAM_INCLUDE_DIR}")

二、/usr/bin/ld: 找不到 -lgtsam/usr/lib/x86_64-linux-gnu/libtbb.so.2

/usr/bin/ld: 找不到 -lgtsam/usr/lib/x86_64-linux-gnu/libtbb.so.2
/usr/bin/ld: 找不到 -lgtsam/usr/lib/x86_64-linux-gnu/libtbb.so.2
collect2: error: ld returned 1 exit status
LeGO-LOAM/LeGO-LOAM/CMakeFiles/mapOptmization.dir/build.make:797: recipe for target '/home/robot/robot_ws/devel/lib/lego_loam/mapOptmization' failed
make[2]: *** [/home/robot/robot_ws/devel/lib/lego_loam/mapOptmization] Error 1
CMakeFiles/Makefile2:2331: recipe for target 'LeGO-LOAM/LeGO-LOAM/CMakeFiles/mapOptmization.dir/all' failed
make[1]: *** [LeGO-LOAM/LeGO-LOAM/CMakeFiles/mapOptmization.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....

解决方法:

很可能是系统有问题,我反正重装系统和ros

三、Install the project...-- Install configuration: "Release"

CMake Error at cmake_install.cmake:41 (file):

[100%] Built target SmartRangeExample_plaza1
[100%] Built target ConcurrentFilteringAndSmoothingExample
Install the project...
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:41 (file):
  file cannot create directory: /usr/local/lib/cmake/GTSAM.  Maybe need
  administrative privileges.


Makefile:150: recipe for target 'install' failed
make: *** [install] Error 1

解决方法:

官方的方法是直接make install,就会出现这个问题,所以用sudo make install安装,安装成功

sudo make install

四、

解决方法:

roslaunch之前一定要source一下

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
source devel/steup.bash
roslaunch lego_loam run.launch

 

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值