segmap重新安装protobuf还是遇到了版本问题This program requires version 3.5.0 of the Protocol Buffer runtime

1.问题描述

编译好segmap后,满心欢喜的去跑了一下程序

roslaunch segmapper kitti_localization.launch

没想到碰到了protobuf的版本问题

[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1.  Please update your library.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1.  Please update your library.  If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library.  (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
[segmapper-4] process has died

它说程序要求的版本是3.5.0,但是我安装的是2.6.1

所以我从源码安装了protobuf 3.5.0版本

在这里插入图片描述

可以看到protobuf 3.5.0的版本已经安装好了,且库文件在
/usr/local/lib/libprotobuf.so.15

但是我重新segmap程序的时候还是报了上述的问题,为什么呢?

2.问题分析

查看kitti_localization.launch启动文件

...
<!-- segmapper node -->
<include file="$(find segmapper)/launch/segmapper.launch">
  <arg name="icp_configuration_file" value="$(find segmapper)/launch/kitti/icp_dynamic_outdoor.yaml"/>
  <arg name="icp_input_filters_file" value="$(find segmapper)/launch/kitti/input_filters_outdoor.yaml"/>
  <arg name="enable_callgrind" value="$(arg enable_callgrind)"/>
</include>
...

可以看到segmapper的节点在segmapper.launch中启动,那我们再去看segmapper.launch文件

<!-- segmapper node -->
<node name="segmapper" pkg="segmapper" type="segmapper_node" output="screen" respawn="false" launch-prefix="$(arg launch_prefix)">
  <param name="icp_configuration_file" value="$(arg icp_configuration_file)"/>
  <param name="icp_input_filters_file" value="$(arg icp_input_filters_file)"/>
</node>

这个节点的可执行文件叫做segmapper_node,它的存放路径在

devel/lib/segmapper

通过ldd命令查看程序所需要的依赖库

libprotobuf.so.11 => /usr/lib/x86_64-linux-gnu/libprotobuf.so.11 (0x00007fa7bb8d9000)

奥,原来它依赖的动态库不是我安装的那一个,那么我重新指定一下

3.解决方案

方法1

通过ll查看/usr/lib/x86_64-linux-gnu/libprotobuf.so.11的链接
在这里插入图片描述

这里可以选择直接更改/usr/lib/x86_64-linux-gnu/libprotobuf.so.11的链接,让他指向/usr/local/lib/libprotobuf.so.15.0.0

sudo ln -s /usr/local/lib/libprotobuf.so.15.0.0 /usr/lib/x86_64-linux-gnu/libprotobuf.so.11

方法2

不更改/usr/lib/x86_64-linux-gnu/libprotobuf.so.11的链接,自己在/usr/local/lib下创建新的软链接
将libprotobuf.so.15.0.0链接给libprotobuf.so.11
(libprotobuf.so.15链接的也是libprotobuf.so.15.0.0)

sudo ln -s /usr/local/lib/libprotobuf.so.15.0.0 /usr/local/lib/libprotobuf.so.11

然后在每次跑segmap程序时,将/usr/local/lib添加到Linux查找共享库环境中

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

但是这样子比较麻烦,也可以直接写在环境变量中,这样不用每次开一个终端在敲一遍

sudo gedit ~/.bashrc

添加一行

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值