rtabmap
rtabmap copied to clipboard
Compilation Error Ubuntu 18.04
Hi,
I got the following error when I make the package(latest):
[ 80%] Linking CXX executable ../../../bin/rtabmap
../../../bin/librtabmap_core.so.0.20.14: undefined reference to OdomEstimationClass::initMapWithPoints(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> > const&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> > const&)' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
OdomEstimationClass::init(lidar::Lidar, double)'
../../../bin/librtabmap_core.so.0.20.14: undefined reference to lidar::Lidar::setMinDistance(double)' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
LaserProcessingClass::LaserProcessingClass()'
../../../bin/librtabmap_core.so.0.20.14: undefined reference to LaserProcessingClass::featureExtraction(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> > const&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >&, boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >&)' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
LaserProcessingClass::init(lidar::Lidar)'
../../../bin/librtabmap_core.so.0.20.14: undefined reference to lidar::Lidar::Lidar()' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
lidar::Lidar::setVerticalAngle(double)'
../../../bin/librtabmap_core.so.0.20.14: undefined reference to OdomEstimationClass::OdomEstimationClass()' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
lidar::Lidar::setLines(double)'
../../../bin/librtabmap_core.so.0.20.14: undefined reference to lidar::Lidar::setMaxDistance(double)' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
OdomEstimationClass::updatePointsToMap(boost::shared_ptr<pcl::PointCloudpcl::PointXYZI > const&, boost::shared_ptr<pcl::PointCloudpcl::PointXYZI > const&)'
../../../bin/librtabmap_core.so.0.20.14: undefined reference to lidar::Lidar::setScanPeriod(double)' ../../../bin/librtabmap_core.so.0.20.14: undefined reference to
OdomEstimationClass::getMap(boost::shared_ptr<pcl::PointCloudpcl::PointXYZI >&)'
collect2: error: ld returned 1 exit status
app/src/CMakeFiles/rtabmap.dir/build.make:746: recipe for target '../bin/rtabmap' failed
make[2]: *** [../bin/rtabmap] Error 1
CMakeFiles/Makefile2:1753: recipe for target 'app/src/CMakeFiles/rtabmap.dir/all' failed
make[1]: *** [app/src/CMakeFiles/rtabmap.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Is it something missing?
Thanks.
Regards,
David
Do you have FLOAM installed? To build with FLOAM, you should use this patched version: http://official-rtab-map-forum.206.s1.nabble.com/icp-odometry-with-LOAM-crash-tp8261p8563.html
To build without FLOAM, do cmake -DWITH_FLOAM=OFF ..
.
I updated the main CMakeLists.txt
in this commit https://github.com/introlab/rtabmap/commit/aee034c5ed9d1909a976d1d4bb1a849eb26e1991 to avoid this kind of error
Hi,
Thanks for the update. Yes, I have FLOAM installed. The new updated CMakeLists.txt is working. Thanks.
If I need to build with FLOAM, with the patch applied, am I correct to say that it can only be done in Ubuntu 20.04 with ROS Noetic?
I didn't test on Melodic, but I guess it could work. I think the patch https://gist.github.com/matlabbe/d8ab56e69146c18afbd1a3b05444c649 is compatible with Melodic. You should use original FLOAM repo though.
@matlabbe Is there a patch for ROS2 (distro foxy) too or just need to alter the cmakelist manually like below ?
cmake_minimum_required(VERSION 3.5)
project(floam)
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -pthread")
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(pcl_conversions REQUIRED)
find_package(PCL REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Ceres REQUIRED)
include_directories(
include
${PCL_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${CERES_INCLUDE_DIRS}
)
link_directories(
${PCL_LIBRARY_DIRS}
${CERES_LIBRARY_DIRS}
)
add_library(floam src/laser_processing_class.cpp src/lidar.cpp src/lidar_optimization.cpp src/odom_estimation_class.cpp src/laser_mapping_class.cpp)
add_executable(laser_processing_node
src/laser_processing_node.cpp
#src/laser_processing.cpp
#src/laser_processing_class.cpp
#src/lidar.cpp
)
ament_target_dependencies(laser_processing_node
rclcpp
sensor_msgs
pcl_conversions
Eigen3
CERES
)
target_link_libraries(laser_processing_node
${PCL_LIBRARIES}
)
add_executable(odom_estimation_node
src/odom_estimation_node.cpp
#src/odom_estimation.cpp
#src/odom_estimation_class.cpp
#src/lidar_optimization.cpp
#src/lidar.cpp
)
ament_target_dependencies(odom_estimation_node
rclcpp
sensor_msgs
nav_msgs
geometry_msgs
tf2
tf2_ros
pcl_conversions
Eigen3
CERES
)
target_link_libraries(odom_estimation_node
${PCL_LIBRARIES}
${EIGEN3_LIBRARIES}
${CERES_LIBRARIES}
)
add_executable(laser_mapping_node
src/laser_mapping_node.cpp
#src/laser_mapping.cpp
#src/laser_mapping_class.cpp
#src/lidar.cpp
)
ament_target_dependencies(laser_mapping_node
rclcpp
sensor_msgs
nav_msgs
pcl_conversions
tf2
tf2_ros
tf2_geometry_msgs
Eigen3
CERES
)
target_link_libraries(laser_mapping_node
${PCL_LIBRARIES}
)
install(TARGETS laser_processing_node odom_estimation_node laser_mapping_node
DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY rviz
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY params
DESTINATION share/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
There is no known patch for ROS2. If you only need floam library in ROS2, I would remove everything ROS1, and just keep the minimal library without any ROS.
@matlabbe Thank you.