(笔记)ROS2: Ubuntu正确安装Glog

 

说明: 在ROS中使用glog时,需注意glog安装正确,否则虽然能够编译通过(colcon build),但实际运行时可能会报一些稀奇古怪的错误:

dade@ubuntu:~/Desktop/yun_pick_ros2$ ros2 launch robot_dispatch all.launch.py
[INFO] [launch]: All log files can be found below /home/dade/.ros/log/2022-11-03-23-20-57-242596-ubuntu-3728
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [dispatch_node-1]: process started with pid [3730]
[ERROR] [dispatch_node-1]: process has died [pid 3730, exit code 127, cmd '/home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/lib/robot_dispatch/dispatch_node --ros-args -r __node:=dispatch_node --params-file /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/share/robot_dispatch/config/robot_info.yaml --params-file /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/share/robot_dispatch/config/dispatch_node.yaml'].
[INFO] [usb_node-2]: process started with pid [3732]
[ERROR] [usb_node-2]: process has died [pid 3732, exit code 127, cmd '/home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/lib/robot_dispatch/usb_node --ros-args -r __node:=usb_node --params-file /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/share/robot_dispatch/config/robot_info.yaml --params-file /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/share/robot_dispatch/config/usb_node.yaml'].
[INFO] [loc_camera_node-3]: process started with pid [3734]
[ERROR] [loc_camera_node-3]: process has died [pid 3734, exit code 127, cmd '/home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/lib/robot_dispatch/loc_camera_node --ros-args -r __node:=loc_camera_node --params-file /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/share/robot_dispatch/config/robot_info.yaml --params-file /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/share/robot_dispatch/config/loc_camera_node.yaml'].
[dispatch_node-1] /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/lib/robot_dispatch/dispatch_node: error while loading shared libraries: libglog.so.1: cannot open shared object file: No such file or directory
[usb_node-2] /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/lib/robot_dispatch/usb_node: error while loading shared libraries: libglog.so.1: cannot open shared object file: No such file or directory
[loc_camera_node-3] /home/dade/Desktop/yun_pick_ros2/install/robot_dispatch/lib/robot_dispatch/loc_camera_node: error while loading shared libraries: libglog.so.1: cannot open shared object file: No such file or directoryi注 

注:上方是我采用Github上的源码的方式进行安装(参见:Ubuntu20.04安装glog - 知乎 (zhihu.com)Ubuntu20.04安装gflags - 知乎 (zhihu.com)),运行报错。

 

后来改为apt方式安装通过:【推荐采用此方式,本人系统为Ubuntu20.04】

//安装
sudo apt-get install libgoogle-glog-dev
//卸载 sudo apt-get remove libgoogle-glog-dev

  

posted on 2022-11-04 14:32  tdyizhen1314  阅读(1956)  评论(0编辑  收藏  举报

导航