记录编译和运行过程中的错误,真的是心态崩阿
前言
下载好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