warning: librealsense2.so.2.50, needed by /usr/local/lib/libpcl_io.so, not found

描述

一个正常的仓库突然报了这样的错误

/usr/bin/ld: warning: librealsense2.so.2.50, needed by /usr/local/lib/libpcl_io.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_frame_width'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_frame_stream_profile'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_frame_bits_per_pixel'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_free_error'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_stream_profiles_count'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_frame_height'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_poll_for_frame'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_process_frame'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_frame_stride_in_bytes'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_release_frame'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_pipeline_start_with_config'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_embedded_frames_count'
/usr/bin/ld: /usr/local/lib/libpcl_io.so: undefined reference to `rs2_get_error_message'
...

问题原因

电脑在当初编译PCL库的时候,恰好也安装了realsense库,在编译PCL库的时候链接了realsense库,导致了PCL库与realsense当时的版本产生了依赖关系

产生依赖关系的库,根据报错信息我们发现是libpcl_io.so的问题

cd到该目录下

cd  /usr/local/lib

查看这个库的依赖关系

ldd /usr/local/lib/libpcl_io.so | grep realsense

显示

librealsense2.so.2.50 => /usr/local/lib/librealsense2.so.2.50 (0x00007f30fa2db000)

可以看出libpcl_io.so确实链接到了librealsense2.so.2.50

我的realsense库安装在了/lib/x86-64-linux-gnu中,当时执行的安装命令我不记得了。在终端执行命令sudo apt-get install librealsense,会提示当前realsense版本是最新的2.53,通过查看/lib/x86-64-linux-gnu路径下库的名称也会发现,是2.53版本

问题在这里,libpcl_io.so需要的是2.50版本(当时pcl编译时,realsense的版本),后期也许在做什么工作时,我升级了realsense,导致版本变为了2.53,这才导致了编译失败

问题解决——回退realsense版本

首先,卸载当前的realsense版本

sudo apt-get purge librealsense

再去/lib/x86-64-linux-gnu你会发现,没有realsense的库了

接下来去github官网,找到realsense仓,查看tag,会发现仓库有2.50.0的tag
先下载下来源码

git clone https://github.com/IntelRealSense/librealsense.git

下拉远端的v2.50.0的tag

cd librealsense
git fetch origin v2.50.0

切换到该版本的tag上

git checkout v2.50.0

接下来安装v2.50.0版本的realsense就可以了

mkdir build
cd build
cmake ..
make -j8
sudo make install

这样,我们就通过v2.50.0版本的源码,生成了librealsense2.so.2.50
这个库,现在和pcl库在一个路径下/usr/local/lib

执行命令,来确认这个事情(没有locate的话执行命令sudo apt install mlocate安装)

locate librealsense2.so

显示结果

/usr/local/lib/librealsense2.so
/usr/local/lib/librealsense2.so.2.50
/usr/local/lib/librealsense2.so.2.50.0

再编译就不会报错了

后续

目前,PCL库已经链接到了v2.50.0版本的realsense
后续只能确保realsense版本一直维持v2.50.0了,不然就要重新编译PCL库才行

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值