Snapping LDC (LLVM-based D compiler)

Andrew Wilkins andrew.wilkins at canonical.com
Tue Aug 30 04:18:27 UTC 2016


On Tue, Aug 30, 2016 at 6:06 AM Joseph Rushton Wakeling <
joseph.wakeling at webdrake.net> wrote:

> On 29.08.2016 03:38, Andrew Wilkins wrote:
> > I've been looking into doing this too, for llgo (Go compiler frontend
> for LLVM).
>
> Nice! :-)
>
> > You need libc6-dev also. After including that, I was then met with
> another
> > issue: libc.so is a linker script, and that uses absolute paths to point
> at the
> > real libraries. I haven't solved that yet. If it's possible to override
> files in
> > a staged package, you could just provide a replacement linker script.
>
> Yea, including libc6-dev gets me to the point where attempting to build a
> program fails with:
>
>      cannot find /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a
>
> ... which I presume is down to the linker script expecting the absolute
> paths
> you describe.
>
> I already edit some stuff after the stage -- my current process is to type
> `snapcraft stage`, and after that completes, editing files in the `stage/`
> directory, followed by `snapcraft snap` to finish it up.
>
> So, in principle it should be possible to edit the stuff in
> stage/usr/lib/x86_64-linux-gnu to change the paths.  (I guess it'll need
> to be
> more than just libc.so though; I'd guess libm.so and libpthread.so will
> also
> need to be tweaked.)
>
> It's a bit late at night for me to start work on it now and I probably
> won't
> have time tomorrow, but I'll give it a go some time this week.  If you get
> to it
> before me and it works for you, let me know!
>

Actually, editing the files isn't necessary at all. You can just pass the
--sysroot option to gcc. I just hacked up a quick gcc snap which works:
    https://gist.github.com/axw/1d4b0206e11ff46a26439244224a4cc9

If you can convince ldc2 to pass the same option (/etc/ldc2.conf?), then it
should just work.

Cheers,
Andrew


> Thanks & best wishes,
>
>      -- Joe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160830/efcd745a/attachment.html>


More information about the Snapcraft mailing list