Snapping LDC (LLVM-based D compiler)

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Sep 1 21:06:53 UTC 2016


On 31.08.2016 21:35, Joseph Rushton Wakeling wrote:
> First things first, run `snapcraft stage`.  Then edit the auto-generated
> stage/etc/ldc2.conf and replace it with this:
> https://gist.github.com/WebDrake/229645efeca14fa54b0b1c82bcbb6477
>
> ... which as you can see includes a compiler flag: `-gcc=ldc2.gcc`.  This should
> ensure that ldc2.gcc is called when LDC wants to call GCC.

OK, I think I have tied down why this is failing.

Under the hood, LDC does a lookup of the full path to the executable whose name 
is passed via the -gcc flag, using llvm::sys::findProgramByName to do so.  If it 
doesn't get a result, it first tries to look up CC, and if that fails, it 
reverts to looking up the path for gcc.

This would suggest that, running within the snap, LDC is not able to find the 
path to ldc2.gcc.

I've also tried passing it -gcc=%%ldcbinarypath%%/../command-gcc.wrapper and 
also -gcc=/snap/ldc2/x1/command-gcc.wrapper and in both cases it still fails. 
The weird thing is that the latter works when it's passed manually:

     ldc2.ldmd2 -gcc=/snap/ldc2/x1/command-gcc.wrapper hello.d

... but not when it's included in the etc/ldc2.conf file.

This would suggest that something about the snap container is preventing LDC 
from resolving the path correctly.  Can anyone more experienced with snappy 
containment advise what could be going on here?

Thanks & best wishes,

     -- Joe





More information about the Snapcraft mailing list