opencv-4.2.0 source-based installation is not used to compile rtabmap_ros
Scenario: I am trying to install rtabmapros-0.20.7-noetic in ubuntu 20.04. By default it installs opencv-4.2.0. To install opencv extra modules I installed opencv from sources. I followed this guideline. Later, when I go on to compiling rtabmapros-0.20.9 noetic, I find the following warnings.
runtime library [libopencv_freetype.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_fuzzy.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_hdf.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_hfs.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_img_hash.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_line_descriptor.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_optflow.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_phase_unwrapping.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_plot.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_quality.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_reg.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_rgbd.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_saliency.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_shape.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_stereo.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_structured_light.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_superres.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_surface_matching.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_text.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_tracking.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_videostab.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_viz.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_ximgproc.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_xobjdetect.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
runtime library [libopencv_xphoto.so.4.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
/usr/local/opencv-4.2.0-opt/lib
Some of these libraries may not be found correctly.
Although the compilation completes successfully, while launching any node of the rtabmap_ros package, it crashes immediately. Now, the following is the query at present.
- How to let rtabmap_ros be compiled with the source installation of opencv-4.2.0?
Asked by Spartan_007 on 2021-11-25 08:46:37 UTC
Comments
The cleanest way would be to remove opencv system binaries (
sudo apt remove libopencv*
). This will remove cv_bridge and all ros packages depending on it, so you would have to rebuild cv_bridge and all packages you need depending on it from source (clone them in your catkin workspace). Then make sure to rebuild/install rtabmap library so that it is linking on your opencv versionAsked by matlabbe on 2021-11-25 17:56:53 UTC
Hi Matheu,
Now, those warnings are not coming anymore after removing the cv_bridge and other packages having prebuilt opencv dependencies. However, when I launch rtabmap.launch file, the following errors show up.
Asked by Spartan_007 on 2021-11-26 02:16:33 UTC
In case important, Currently, I compiled rtabmap_ros-0.20.7-noetic (edited in the first post too). I am using ubuntu-20.04, gcc-10.3.0. System specs: CPU-i7-11375H. The above-mentioned error did not arise earlier for rtabmap-0.20.7-melodic version.
Asked by Spartan_007 on 2021-11-26 02:19:42 UTC
See step A from this issue to debug "process has died" errors, make sure to copy/paste here the full "backtrace" from gdb.
Asked by matlabbe on 2021-11-26 09:24:25 UTC
Following is the output when I launch only rtabmap node.
It is given in two separate comments.
Asked by Spartan_007 on 2021-11-27 03:09:55 UTC
next part
Asked by Spartan_007 on 2021-11-27 03:12:04 UTC
last part:
Asked by Spartan_007 on 2021-11-27 03:12:29 UTC
Hi, I saw the post you had referred to. Then, I reinstalled
g2o-20201223_git
tag (g2omaster
branch throws an error as it does not contain a member variableVertexSBAPointXYZ
), andgtsam-4.0.3
in debug mode. Then, I installedrtabmap-0.20.7-noetic
. Subsequently, I tried to runrtabmap-console
with gdb. The outcome is provided here. Following that, I also tried running it withValgrind
. The corresponding output is divided into two consecutive links. (link1, link2)Please look into it.
Asked by Spartan_007 on 2021-11-28 23:45:25 UTC
Is PCL compiled from source? It may add
-march=native
indirectly to rtabmap build, and if g2o is not built with march=native, this causes Eigen errors. Same problem if PCL binaries are used (without-march=native
) and if g2o is built with that flag, it will also crash. Can you post your cmake log output of rtabmap? to see if -march=native is used. Ideally, rtabmap will build/run smoothly if a ll dependencies are installed from binaries (apt install), otherwise we should take care of the-march-native
flag when compiling dependencies also using Eigen (PCL, g2o, gtsam, libpointmatcher are all using eigen).Asked by matlabbe on 2021-11-29 13:08:50 UTC
PCL
was built from binary. I checked thatg2o
source build also defaulted to without-march=native
. However, cmake ofgtsam
showed that it had used-march=native
. So, I set that off.rtabmap
works fine now. Thank you for pointing it out,Asked by Spartan_007 on 2021-11-29 23:48:34 UTC