Trouble linking libmozjs

Hello All,

I am using snapcraft in destructive-mode under lxd running focal with base: core20 and build-base: core18.

The c code links to libmozjs-68.so.0 but snapcraft gives the following error.

This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:
- lib/x86_64-linux-gnu/libmozjs-68.so.0
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.

I can see that libmozjs-68.so.68 is available in the libmozjs-68-0 package. On my base system there is a soft link to this from libmozjs-68.so.0 to libmozjs-68.so.68; and if I manual add this with ln -s in the prime directory the package will build locally correctly.

But I am unable upload to the store.

The store was unable to accept this snap.
  - package contains external symlinks: lib/x86_64-linux-gnu/libmozjs-68.0

Do I need to change my link address? Is the .0 convention no longer available.

Much Thanks

make sure to have libmozjs-68-0 in stage-packages:

if you still have troubles, you can create the symlink inside the prime directory (to lib/x86_64-linux-gnu/libmozjs-68.so.68 (note the missing first slash)) from an override-prime directive …

1 Like

Great. Thanks. The slash hint helped. Would running ldconfig as a part of the snapcraft.yaml also do this? If so which stanza does it belong? As an aside, for the long term solution, the libmozjs maintainers have added the libmozjs-68.so.0 link to the package.

normally you do not use the ld cache at all in snaps but instead define the LD_LIBRARY_PATH variable … that said … the gimp snap has some scripts that use a re-located ld.so.cache file that gets created from the install hook … in case you really want to use a cache and ldconfig have a look at the scripts, hooks and the snapcraft.yaml:

1 Like