Run executable from bash script after snap was created

I am trying to make bash script that will turn the lights on, using WiringNP

This is my snapcraft.yaml:

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode
#confinement: classic
architectures: [all]

parts:
  mainb:
    plugin: dump
    source: .
    override-build: |
      snapcraftctl build

      rm -r WiringNP
      git clone https://github.com/friendlyarm/WiringNP
      cd WiringNP/
      chmod 755 build
      ./build
      gpio

    build-packages:
      - git


apps:
  mainb:
    command: ./lightOn.sh
  onn:
    command: gpio

As you can see I am trying to execute the command gpio in the override-build part, and it works.

When I install the snap and try mainb.onn (which run the gpio command) I get /snap/mainb/x9/command-onn.wrapper: 2: exec: gpio: not found.

Tried my lightOn.sh file with 2 different command and non of them worked.

First command: gpio
Returned: /snap/mainb/x10/./lightOn.sh: line 9: gpio: command not found

Second command: /snap/mainb/current/WiringNP/gpio/gpio
Return: /snap/mainb/current/WiringNP/gpio/gpio: error while loading shared libraries: libwiringPi.so: cannot open shared object file: No such file or directory

What do I need to do in order to build and run executable inside the snap from bash script.

take a look inside the snap structure under the prime directory after your build and see if all libs and inaries ended up where you look for them …