segmap重新安裝protobuf還是遇到了版本問題This program requires version 3.5.0 of the Protocol Buffer runtime
阿新 • • 發佈:2020-12-14
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的版本已經安裝好了,且庫檔案在
但是我重新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