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: libopencv_calib3d3.so.3.2:
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

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

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

  aruco-localizer:
    command: roslaunch main_launch aruco_localization_live.launch
    plugs: [network, network-bind]
    environment:
      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.

my-ros-snap.usbcam

However, the command

my-ros-snap.aruco-localizer

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 libopencv_calib3d3.so.3.2 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.