Yes.
Snapcraft will do its own dependency resolution. It’s not perfect, but that’s why they are only presented as warnings. The difference in behavior you are seeing is because snapcraft will resort to scanning the entire snap for libraries, assuming the snap author setup the correct LD_LIBRARY_PATH for runtime.
$SNAP is a runtime variable set in the process of the running snap. $SNAPCRAFT_STAGE,PRIME are build-time variables.
Maybe try something like this, using a relative symlink at build-time:
parts:
<part>:
override-build: |
snapcraftctl build
ln -sf ../libpsm1/libpsm_infinipath.so.1.16 $SNAPCRAFT_PART_INSTALL/usr/lib/x86_64-linux-gnu/libpsm_infinipath.so.1
If the source symlink is correct, and it resides in your library path, you won’t need to modify LD_LIBRARY_PATH.
For example, if you added $SNAP/usr/lib/libpsm1
to your LD_LIBRARY_PATH, the symlink example above would be:
ln -sf libpsm_infinipath.so.1.16 $SNAPCRAFT_PART_INSTALL/usr/lib/libpsm1/libpsm_infinipath.so.1
Hope that helps!