Snapping LDC (LLVM-based D compiler)

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Aug 28 21:21:00 UTC 2016


On 28.08.2016 18:28, Mark Shuttleworth wrote:
> Try $SNAP for the location of the snap root, and there are a few others
> like $SNAP_DATA and $SNAP_COMMON and $SNAP_USER_DATA and
> $SNAP_USER_COMMON which are writable directories (the COMMON ones are
> unversioned the others get snapshotted on update). The snap also get its
> own /tmp directory.

I found a different solution courtesy of LDC itself: it supports a wildcard 
%%ldcbinarypath%% that can be inserted into paths in the ldc2.conf file.

It's easy to handle this manually -- just `snapcraft stage`, a quick 
search'n'replace in stage/etc/ldc2.conf, and then `snapcraft snap` to finish 
things up -- but is there any way to insert some sort of end-of-stage hook to do 
this automatically?  Being able to trigger a simple `sed` call would be enough, 
I'd have thought.

I can always provide a Makefile that carries out the stages, but it'd be nice if 
it was possible to just specify this from within snapcraft.yaml.

> Yes you can arrange for the snap to see stuff from the rest of the
> world, but the more of that you have, the more you burden the user to
> get all those bits in place. I would explore the bundling option and see
> how that pans out. It doesn't look like it's particularly large. And
> we're adding delta updates so even if it is quite large it will only
> affect update sizes when it changes.

OK, makes sense.  According to the LDC devs:

     You need a GCC-compatible linker driver, which links in the C
     standard libraries. (The latter is the reason why (g)cc is used
     instead of ld.) You might need to pull in the full GCC package
     if there is no other way to depend on a C toolchain.

... which is a bit 'ouch', but seems like a viable enough starting point.

Just to make sure I don't head off in completely the wrong direction, is there a 
straightforward (or at least, advisable) way to include gcc and the C standard 
libraries in a snap, perhaps deriving from existing Ubuntu packages?  I imagine 
this doesn't have a ready solution yet, but just to make sure...

Thanks again & best wishes,

     -- Joe




More information about the Snapcraft mailing list