【无标题】

项目场景:

编译雷达相机项目时遇到PCL和OPENCV的版本号出现的问题:

link library [libpcl_io.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
      /usr/local/lib

usr/bin/ld: warning: libopencv_core.so.3.4, needed by /usr/local/lib/libopencv_features2d.so.3.4.0, may conflict with libopencv_core.so.4.2

 


解决方案:

PCL:

Cmakelists中原本

find_package(PCL REQUIRED)

重新指定路径,排除自带的文件,改为:

set(PCL_DIR "/usr/local/lib/")

find_package(PCL 1.8 REQUIRED)

file(GLOB_RECURSE OLD_PCL "/usr/lib/x86_64-linux-gnu/libpcl*")

list(REMOVE_ITEM catkin_LIBRARIES ${OLD_PCL})

link_directories(${PCL_LIBRARY_DIRS})

add_definitions(${PCL_DEFINITIONS})

OPENCV:

按照pcl同样的方法修改后仍报错,直接修改cv_bridge中的内容:

打开 /opt/ros/noetic/share/cv_bridge/cmake/cv_bridgeConfig.cmake  进行替换

1)

#if(NOT "include;/usr/include/opencv4 " STREQUAL " ")
==>
if(NOT "include;/usr/local/include/opencv " STREQUAL " ")

#set(_include_dirs "include;/usr/include/opencv4")
==>
set(_include_dirs "include;/usr/local/include/opencv")

"/usr/local/include/opecncv"是自己安装的路径

2) 替换lib的路径,注意自己安装路径中没有的lib需要删掉。

set(libraries "cv_bridge;/usr/include/x86_64-linux-gnu/.....
==>
set(libraries "cv_bridge;/usr/local/lib/libopencv_calib3d.so.3.4.0;....

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值