紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
编译vins_fusion遇到opencv库链接冲突
-
https://github.com/HKUST-Aerial-Robotics/VINS-Fusion
catkin_make结果:[ 90%] Linking CXX executable /home/bluesea/vins_ws/devel/lib/loop_fusion/loop_fusion_node /usr/bin/ld: warning: libopencv_calib3d.so.3.4, needed by /home/bluesea/vins_ws/devel/lib/libcamera_models.so, may conflict with libopencv_calib3d.so.4.2 /usr/bin/ld: warning: libopencv_imgproc.so.3.4, needed by /home/bluesea/vins_ws/devel/lib/libcamera_models.so, may conflict with libopencv_imgproc.so.4.2 /usr/bin/ld: warning: libopencv_core.so.3.4, needed by /home/bluesea/vins_ws/devel/lib/libcamera_models.so, may conflict with libopencv_core.so.4.2 /usr/bin/ld: warning: libopencv_video.so.4.2, needed by /home/bluesea/vins_ws/devel/lib/libvins_lib.so, may conflict with libopencv_video.so.3.4 /usr/bin/ld: warning: libopencv_imgcodecs.so.3.4, needed by /home/bluesea/vins_ws/devel/lib/libvins_lib.so, may conflict with libopencv_imgcodecs.so.4.2 /usr/bin/ld: warning: libopencv_core.so.3.4, needed by /usr/local/lib/libopencv_video.so.3.4.11, may conflict with libopencv_core.so.4.2 [ 98%] Built target kitti_gps_test /usr/bin/ld: warning: libopencv_video.so.4.2, needed by /home/bluesea/vins_ws/devel/lib/libvins_lib.so, may conflict with libopencv_video.so.3.4 /usr/bin/ld: warning: libopencv_imgcodecs.so.3.4, needed by /home/bluesea/vins_ws/devel/lib/libvins_lib.so, may conflict with libopencv_imgcodecs.so.4.2 /usr/bin/ld: warning: libopencv_core.so.3.4, needed by /usr/local/lib/libopencv_video.so.3.4.11, may conflict with libopencv_core.so.4.2 [ 98%] Built target kitti_odom_test /usr/bin/ld: warning: libopencv_video.so.4.2, needed by /home/bluesea/vins_ws/devel/lib/libvins_lib.so, may conflict with libopencv_video.so.3.4 /usr/bin/ld: warning: libopencv_core.so.3.4, needed by /usr/local/lib/libopencv_video.so.3.4.11, may conflict with libopencv_core.so.4.2 [100%] Built target vins_node
运行节点vins_node报错:段错误(核心已转储)
尝试解决:
https://blog.csdn.net/qq_52068373/article/details/127871743
将/opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake按照博客中的修改后编译报错-- +++ processing catkin package: 'loop_fusion' -- ==> add_subdirectory(VINS-Fusion/loop_fusion) -- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy CMake Error at /opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:173 (message): Project 'loop_fusion' tried to find library 'usr/local/lib/libopencv_calib3d.so'. The library is neither a target nor built/installed properly. Did you compile project 'cv_bridge'? Did you find_package() it before the subdirectory containing its code is included? Call Stack (most recent call first): /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package) VINS-Fusion/loop_fusion/CMakeLists.txt:9 (find_package) -- Configuring incomplete, errors occurred!
请问如何解决
-
@2790341615 我也遇到过。有个功能只有在高版本的OpenCV中才有实现。
最后的解决方法为,将冲突的包在本地编译而不是安装ROS编译好的版本,就可以统一使用编译环境的OpenCV了。
如果是一些内置包,比如CV_Bridge之类的,有许多其他包依赖无法卸载的,我的做法是拉取源码,然后把包名批量替换为my_cv_bridge,然后只在我需要不同的OpenCV版本的地方才用这个自己替换后的包,达到统一版本的效果。
-
十分简单和无语:不用改cv_bridgeConfig,由于ros使用4.2,只要vins也用4.2就行了,在报错的功能包cmakelist加入
find_package(OpenCV 4)
,并将 #include "opencv2/imgcodecs/legacy/constants_c.h" 在任意一个 .cpp file(如KITTIGPSTest.cpp)就可以了