Errors when building for Foxy (0.21.1)
Hi,
A bit of context first: I'm trying to build the Swarm-SLAM software (https://github.com/MISTLab/Swarm-SLAM) which is working on foxy and requires rtabmap and rtabmap_ros.
Trying to build the current version leads to an error related to rtabmap:
CMake Deprecation Warning at /usr/local/share/pcl-1.9/PCLConfig.cmake:42 (cmake_policy):
The OLD behavior for policy CMP0074 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
CMakeLists.txt:73 (find_package)
CMake Error at /opt/ros/foxy/lib/x86_64-linux-gnu/rtabmap-0.21/RTABMap_coreTargets.cmake:56 (set_target_properties):
The link interface of target "rtabmap::core" contains:
-FLANN::FLANN
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
/opt/ros/foxy/lib/x86_64-linux-gnu/rtabmap-0.21/RTABMapConfig.cmake:58 (include)
/opt/ros/foxy/share/rtabmap_conversions/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
/opt/ros/foxy/share/rtabmap_conversions/cmake/rtabmap_conversionsConfig.cmake:41 (include)
CMakeLists.txt:54 (find_package)
The developper of Swarm-SLAM has not been able to find a solution to the issue and suggested to install rtabmap and rtabmap_ros from source, which I did (with tag 0.21.1-foxy).
Doing so, rtabmap compiles without any issue, but rtabmap_ros, and more specifically rtabmap_odom fails with the following error:
/usr/bin/ld: librtabmap_odom.so: undefined reference to `rosidl_service_type_support_t const* rosidl_typesupport_cpp::get_service_type_support_handle<std_srvs::srv::Empty>()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/rtabmap_stereo_odometry.dir/build.make:578: stereo_odometry] Error 1
make[1]: *** [CMakeFiles/Makefile2:225: CMakeFiles/rtabmap_stereo_odometry.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/bin/ld: librtabmap_odom.so: undefined reference to `rosidl_service_type_support_t const* rosidl_typesupport_cpp::get_service_type_support_handle<std_srvs::srv::Empty>()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/rtabmap_icp_odometry.dir/build.make:578: icp_odometry] Error 1
make[1]: *** [CMakeFiles/Makefile2:252: CMakeFiles/rtabmap_icp_odometry.dir/all] Error 2
/usr/bin/ld: librtabmap_odom.so: undefined reference to `rosidl_service_type_support_t const* rosidl_typesupport_cpp::get_service_type_support_handle<std_srvs::srv::Empty>()'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/rtabmap_rgbd_odometry.dir/build.make:578: rgbd_odometry] Error 1
make[1]: *** [CMakeFiles/Makefile2:198: CMakeFiles/rtabmap_rgbd_odometry.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
I'm a bit stuck here, I have tried a lot of things including uninstall/reinstall completely foxy, so if you have any idea of what could cause either of these errors, that would be super helpful!
Thank you for your time
For the first error, are you building a recent rtabmap_ros over the installed 0.21 binaries on foxy? I'll suggest to uninstall all rtabmap binaries and rebuild them from source to avoid rtabmap_ros trying to link on rtabmap binaries instead of the ones in the workspace.
sudo apt remove ros-foxy-rtabmap*
For the FLANN thing, it may be related to PCL 1.9 that seems installed from source (/usr/local). That FLANN dependency is coming from PCL. On my foxy computer, PCL 1.10 is installed and I don't see this issue when building latest version of rtabmap and rtabmap_ros. Also tried 0.21.1-foxy tags from both repos and they compiled without errors.
For the rosidl_service linker errors, I am not sure. Maybe cleanup your build/install space of ros2 workspace before doing a fresh build.
cheers, Mathieu