Closed vickyskarthik closed 2 years ago
@vickyskarthik how fix this issue? I have same problem. This is the error report:
109.3 /usr/bin/ld: cannot find -lBoost::timer
109.3 collect2: error: ld returned 1 exit status
109.3 make[2]: *** [/ws/devel/lib/aloam_velodyne/alaserPGO] Error 1
109.3 SC-A-LOAM/CMakeFiles/alaserPGO.dir/build.make:487: recipe for target '/ws/devel/lib/aloam_velodyne/alaserPGO' failed
109.3 make[2]: Leaving directory '/ws/build'
109.3 CMakeFiles/Makefile2:1439: recipe for target 'SC-A-LOAM/CMakeFiles/alaserPGO.dir/all' failed
109.3 make[1]: Leaving directory '/ws/build'
109.3 make[1]: *** [SC-A-LOAM/CMakeFiles/alaserPGO.dir/all] Error 2
109.3 Makefile:143: recipe for target 'all' failed
109.3 make: *** [all] Error 2
I fix this problem, I add boost dependencies in CMakeLists.txt file and it works for me. This is the new one:
cmake_minimum_required(VERSION 2.8.3)
project(aloam_velodyne)
set(CMAKE_BUILD_TYPE "Release")
# set(CMAKE_CXX_FLAGS "-std=c++11")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")
find_package(Boost REQUIRED COMPONENTS timer)
include_directories(${Boost_INCLUDE_DIRS})
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
nav_msgs
sensor_msgs
roscpp
rospy
rosbag
std_msgs
image_transport
cv_bridge
tf
)
#find_package(Eigen3 REQUIRED)
find_package(PCL REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Ceres REQUIRED)
find_package(OpenMP REQUIRED)
find_package(GTSAM REQUIRED QUIET)
include_directories(
include
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
${CERES_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${GTSAM_INCLUDE_DIR}
)
catkin_package(
CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs
DEPENDS EIGEN3 PCL
INCLUDE_DIRS include
)
add_executable(ascanRegistration src/scanRegistration.cpp)
target_link_libraries(ascanRegistration ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${Boost_LIBRARIES})
add_executable(alaserOdometry src/laserOdometry.cpp)
target_link_libraries(alaserOdometry ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${CERES_LIBRARIES} ${Boost_LIBRARIES})
add_executable(alaserMapping src/laserMapping.cpp)
target_link_libraries(alaserMapping ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${CERES_LIBRARIES} ${Boost_LIBRARIES})
add_executable(alaserPGO
src/laserPosegraphOptimization.cpp
include/scancontext/Scancontext.cpp
)
target_compile_options(alaserPGO
PRIVATE ${OpenMP_CXX_FLAGS}
)
target_link_libraries(alaserPGO
${catkin_LIBRARIES} ${PCL_LIBRARIES} ${CERES_LIBRARIES} ${Boost_LIBRARIES}
${OpenMP_CXX_FLAGS}
gtsam
)
add_executable(kittiHelper src/kittiHelper.cpp)
target_link_libraries(kittiHelper ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBS})
After installing the necessary dependencies and cloning the git, I faced the following error during build:
[ 90%] Built target alaserMapping [ 90%] Built target ascanRegistration [100%] Linking CXX executable /home/mcw/catkin_scaloam/devel/lib/aloam_velodyne/alaserPGO /usr/bin/ld: cannot find -lBoost::timer collect2: error: ld returned 1 exit status SC-A-LOAM/CMakeFiles/alaserPGO.dir/build.make:468: recipe for target '/home/mcw/catkin_scaloam/devel/lib/aloam_velodyne/alaserPGO' failed make[2]: [/home/mcw/catkin_scaloam/devel/lib/aloam_velodyne/alaserPGO] Error 1 CMakeFiles/Makefile2:1436: recipe for target 'SC-A-LOAM/CMakeFiles/alaserPGO.dir/all' failed make[1]: [SC-A-LOAM/CMakeFiles/alaserPGO.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j4 -l4" failed