Further ABI-related issues for ldc2 snap on 14.04 ... ?

Sergio Schvezov sergio.schvezov at canonical.com
Sun Mar 5 13:10:14 UTC 2017


On Thu, Feb 23, 2017 at 12:18 PM, Joseph Rushton Wakeling <
joseph.wakeling at webdrake.net> wrote:

> Hello all,
>
> I've encountered a couple of further issues with the ldc2 compiler snap
> when it's installed on a 14.04 system.  I'm sharing here to confirm if
> these are indeed ABI issues which might be fixable in terms of how
> snapcraft constructs the package.
>
> The first [1] relates to zlib, which is included as part of the D standard
> library.  This is built from a copy of the zlib C source and linked in to
> the rest of the library.
>
> However, if I try to build a program that makes use of the zlib library
> modules, linking fails with the following error:
>
> /usr/bin/gcc zlibtest.o -o zlibtest -L/snap/ldc2/x1/bin/../lib
> -lphobos2-ldc -ldruntime-ldc -Wl,--gc-sections -lrt -ldl -lpthread -lm -m64
> /usr/bin/ld: /snap/ldc2/x1/bin/../lib/libphobos2-ldc.a(zutil.c.o):
> unrecognized relocation (0x2a) in section `.text'
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
> Error: /usr/bin/gcc failed with status: 1
>
> This matches the error message observed in a past Ubuntu issue related to
> binutils: https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1545653
>
> which would suggest that there's a problematic mismatch between the
> binutils used to build snap packages versus the one available on 14.04.
>
> The second issue [2] relates to a plugin for the gold linker that is built
> for LDC to enable it to use link-time optimization.  This works fine on
> 16.04, 16.10 and 17.04, but requesting LTO on 14.04 results in linking
> failing:
>
> /usr/bin/gcc hello.o -o hello -Xlinker -plugin -Xlinker
> /snap/ldc2/x1/lib/LLVMgold-ldc.so -Xlinker -plugin-opt=O0
> -L/snap/ldc2/x1/bin/../lib -lphobos2-ldc -ldruntime-ldc -Wl,--gc-sections
> -lrt -ldl -lpthread -lm -m64
> /usr/bin/ld: /snap/ldc2/x1/lib/LLVMgold-ldc.so: error loading plugin:
> /snap/core/current/lib/x86_64-linux-gnu/libpthread.so.0: symbol
> __libc_vfork, version GLIBC_PRIVATE not defined in file libc.so.6 with link
> time reference
> collect2: error: ld returned 1 exit status
> Error: /usr/bin/gcc failed with status: 1
>
> ... which looks to me like it is probably a mismatch between the libc used
> to build the plugin, versus the libc of either the host system or the core
> snap?
>
> I would presume that both the above would need a fix either snapcraft-side
> or core snap side ... ?  Can anyone advise/assist?
>
>
I think you have come to a cross roads where you will need to choose to
either always use the linker from the core snap and link to things from
your snap or provide multiple zlib targets for different versions of glibc
(or any other library you want to link with and provide it in your snap).

If you are going to have things like
/snap/core/current/lib/x86_64-linux-gnu/libpthread.so.0
you would certainly want to use the linker in core. If you are going to use
/usr/bin/gcc you probably shouldn't include libraries from `/snap/...`.

I am sorry that I cannot help you more without deep diving into your
project.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170305/7d77e811/attachment.html>


More information about the Snapcraft mailing list