How to add custom libs to snap?

knitzsche kyle.nitzsche at canonical.com
Mon Jan 9 14:07:41 UTC 2017



On 01/09/2017 05:14 AM, Alan Pope wrote:
> Hi Andrey,
>
> On 9 January 2017 at 08:59, Andrey Rogovsky <a.rogovsky at gmail.com> wrote:
>> I need add custom precompiled libs (no sources) to my snap.
>> I have directory with libs. Need put it into snap. How I can do it?
>
> I achieved this with one of my snaps by simply using the copy plugin
> to put the libs into lib/<triple> and then having a launch script
> which ensures the LD_LIBRARY_PATH is set appropriately.

If memory serves, the copy plugin is deprecated in favor of the dump 
plugin. Here's a small example:

     environment:
         plugin: dump
         source: .
         organize:
           run.wrapper: bin/run

It means there's a file in root dir (".") named run.wrapper and it 
should be copied (dumped) to bin/run in the snap, as I understand it.

Cheers,
Kyle

>
> So, (assuming you're only targetting amd64) copy the libs to
> lib/x86_64-linux-gnu and in your launcher have something along the
> lines.
>
> export LD_LIBRARY_PATH=$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
>
> Cheers,
>




More information about the Snapcraft mailing list