Libpxbackend-1.0.so: cannot open shared object file: No such file or directory


Some details about the snapcraft.yaml:

base: core24

snapcraft builds my snap fine, but if I then run

sudo snap run --shell "mySnap"

then I get this message:

libpxbackend-1.0.so: cannot open shared object file: No such file or directory

I do have

    stage-packages:
      - libproxy1v5
...

(libproxy1v5 is the lib containing libpxbackend-1.0.so).

How do I solve that ?

This is a known issue - it’s down to the libpxbackend being in a subdirectory which isn’t on the LD_LIBRARY_PATH. As a workaround, you can add this to your snapcraft.yaml:

   apps:
       foo:
          environment:
                LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libproxy

See some discussion in this similar pull request: