<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Aug 30, 2016 at 6:06 AM Joseph Rushton Wakeling <<a href="mailto:joseph.wakeling@webdrake.net">joseph.wakeling@webdrake.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 29.08.2016 03:38, Andrew Wilkins wrote:<br>
> I've been looking into doing this too, for llgo (Go compiler frontend for LLVM).<br>
<br>
Nice! :-)<br>
<br>
> You need libc6-dev also. After including that, I was then met with another<br>
> issue: libc.so is a linker script, and that uses absolute paths to point at the<br>
> real libraries. I haven't solved that yet. If it's possible to override files in<br>
> a staged package, you could just provide a replacement linker script.<br>
<br>
Yea, including libc6-dev gets me to the point where attempting to build a<br>
program fails with:<br>
<br>
     cannot find /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a<br>
<br>
... which I presume is down to the linker script expecting the absolute paths<br>
you describe.<br>
<br>
I already edit some stuff after the stage -- my current process is to type<br>
`snapcraft stage`, and after that completes, editing files in the `stage/`<br>
directory, followed by `snapcraft snap` to finish it up.<br>
<br>
So, in principle it should be possible to edit the stuff in<br>
stage/usr/lib/x86_64-linux-gnu to change the paths.  (I guess it'll need to be<br>
more than just libc.so though; I'd guess libm.so and libpthread.so will also<br>
need to be tweaked.)<br>
<br>
It's a bit late at night for me to start work on it now and I probably won't<br>
have time tomorrow, but I'll give it a go some time this week.  If you get to it<br>
before me and it works for you, let me know!<br></blockquote><div><br></div><div>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:</div><div><span style="line-height:1.5">    <a href="https://gist.github.com/axw/1d4b0206e11ff46a26439244224a4cc9">https://gist.github.com/axw/1d4b0206e11ff46a26439244224a4cc9</a></span></div><div><br></div><div>If you can convince ldc2 to pass the same option (/etc/ldc2.conf?), then it should just work.</div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">Cheers,</span></div><div><span style="line-height:1.5">Andrew</span></div><div><span style="line-height:1.5"> </span><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks & best wishes,<br>
<br>
     -- Joe<br>
</blockquote></div></div>