ROS - error while loading shared libraries:

Hi All,
I followed the tutorial from Kyrofa block to snapcraft ros package, but I encountered the following error

error while loading shared libraries:
cannot open shared object file: No such file or directory

My workspace have two packages:

  1. aruco_localization. This ultiizes aruco lib and opencv lib.
  2. main_launch: this package has 2 launch files: aruco_localization_live.launch and usb_cam.launch

My snapcraft.yaml is:

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

    plugin: catkin
    rosdistro: lunar
    catkin-packages: [main_launch, aruco_localization]

    command: roslaunch main_launch usb_cam_launch.launch 
    plugs: [network, network-bind]

    command: roslaunch main_launch aruco_localization_live.launch
    plugs: [network, network-bind]
      LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/local/lib 

I can catkin_make the packages and use it in ROS without problems, and snapcarft it without error. I installed the snap by

$sudo snap install --devmode my-ros-snap_0.1_amd64.snap

and running the following command without any error.


However, the command


throws the error of missing libopencv.

The aruco lib was installed to /usr/local/lib (as default value), and the opencv package was installed to /opt/ros/lunar (come with ROS full-desktop install). Particullarly, the file is in /opt/ros/lunar/lib.

Please let me know if I can provide any other information to clarify the problem.
Thanks in advance.

P/S: When i edit my packages cmake files, and snapcraft.yaml and redo snapcraft, do I need to remove the parts, prime and stage folders to update the files.

Sorry, it was my bad. I have aruco package previously compiled with opencv 3.2, and then I upgrade ROS (openCV 3.3) without recompiled ARUCO, and that causes problem. Recompiling ARUCO solved my problem.