在Ubuntu20.04下编译Lio-LOAM时,遇到如下问题
/usr/bin/ld: cannot find -lBoost::serialization
/usr/bin/ld: cannot find -lBoost::thread
/usr/bin/ld: cannot find -lBoost::timer
/usr/bin/ld: cannot find -lBoost::chrono
collect2: error: ld returned 1 exit status
查询so的链接之后并无问题,文件是存在的,但是系统找不到。想起之前编译的Kimera-VIO-ros中的CMakeLists中手动找了boost的文件,所以仿照它的方法,修改了CMakeLists,成功解决问题。
find_package添加boost
find_package(Boost REQUIRED COMPONENTS
serialization timer thread chrono)
directories添加boost
# include directories
include_directories(
include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${GTSAM_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
)
# link directories
link_directories(
include
${PCL_LIBRARY_DIRS}
${OpenCV_LIBRARY_DIRS}
${GTSAM_LIBRARY_DIRS}
${Boost_INCLUDE_DIRS}
)
至此,编译完成