getting $LDFLAGS for a classic snap build in the plugin

Michael Hudson-Doyle michael.hudson at canonical.com
Wed Mar 1 02:11:54 UTC 2017


Hi,

The magic of classic confinement snaps is all in passing special flags when
linking an executable. If I've read things right, snapcraft does this by
wrapping any command you execute with BasePlugin.run() with some shell code
that sets LDFLAGS.

Unfortunately, for the go classic snap the underlying tool does not care at
all about LDFLAGS. What I do is create a wrapper:

#!/bin/sh
exec gcc $LDFLAGS "$@"

and point the go tool at that. This works but it would be a lot cleaner if
I could just get at the linker flags in my snap's plugin. Any chance that
could be added?

Cheers,
mwh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170301/f6506f1f/attachment.html>


More information about the Snapcraft mailing list