问题:
在导入cmakelist之后运行功能包出现找不到动态链接库
error while loading shared libraries: libxmlrpcpp.so: cannot open shared object file: No such file or directory
error while loading shared libraries: librosconsole_log4cxx.so: cannot open shared object file: No such file or directory
原因:
Qt只加载了其包含的一个库,没有将ros里边相关的库包含进去
环境配置
- ros-melodic
- ubuntu18.04
- Qt5.9.9
解决办法
- 打开终端,安装第一个库
sudo apt install libxmlrpcpp-dev
- 链接其他库
- 打开ld.so.conf
vi /etc/ld.so.conf
- 在
include ld.so.conf.d/*.conf
下边换行添加/usr/local/lib
和opt/ros/melodic/lib
- 添加好后保存退出,还需要将文件/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache以供使用
/sbin/ldconfig -v
- 接着执行
ldconfig
之后就可以重新导入Cmakelist文件进行运行