Closed Userpc1010 closed 1 year ago
Not sure why you had the error, unless it is an octomap bug. For recent octomap, we use by default cmake targets if they exist instead of LIBRARIES/INCLUDE_DIRS: https://github.com/introlab/rtabmap/blob/092f6abccc0f19ad0bc8397ccd723e3de34ebd28/corelib/src/CMakeLists.txt#L570-L590
In your case, it means it was able to find octomap target, but the target has missing IMPORTED_LOCATION. I see you built octomap from source, which commit version are you using? (here with ros noetic 1.9.8 octomap version, it works correctly)
I used the latest version currently available from the repository. Before this, I had a similar error when building No rule to make target 'octomap-NOTFOUND'
What is your system? Just tried on ubuntu 20.04, cloning that repo, install it, remove ros-noetic-octomap, cleanup rtabmap's build directory, then do cmake. I didn't get error in cmake log, but one when the compiler tries linking librtabmap_core.so
:
make[2]: *** No rule to make target 'octomap-NOTFOUND', needed by 'bin/librtabmap_core.so.0.21.1'. Stop.
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:936: corelib/src/CMakeFiles/rtabmap_core.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
The problem is that octomap doesn't set a default for CMAKE_BUILD_TYPE
, so not sure if it is why the target is not correctly exported. Rebuilt/installed octomap in release mode fixed the issue:
cd octomap/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6
sudo make install
I used Ubuntu 20.04, probably this was the problem, I just repeated the input from the README without -DCMAKE_BUILD_TYPE=Release
.
Temporary solution in CMakeLists.txt: