ldc-developers / ldc2.snap

Snap package definition for LDC, the LLVM-based D compiler
11 stars 4 forks source link

LTO fails on Ubuntu 14.04 and OpenSUSE #18

Open WebDrake opened 7 years ago

WebDrake commented 7 years ago

While the -flto flag works fine on Ubuntu 16.04 and 16.10, it will fail on 14.04.

Output from attempting to compile a simple "Hello, world!":

$ ldc2 -v -flto=full hello.d 
binary    /snap/ldc2/x1/bin/ldc2
version   1.1.1-beta1 (DMD v2.071.2, LLVM 3.9.1)
config    /snap/ldc2/x1/etc/ldc2.conf (x86_64-unknown-linux-gnu)
predefs   LDC all D_Version2 assert X86_64 D_InlineAsm_X86_64 D_HardFloat
          LittleEndian D_LP64 D_PIC linux Posix CRuntime_Glibc LDC_LLVM_309
parse     hello
importall hello
import    object    (/snap/ldc2/x1/bin/../include/d/ldc/object.d)
semantic  hello
entry     main          hello.d
semantic2 hello
semantic3 hello
import    std.stdio (/snap/ldc2/x1/bin/../include/d/std/stdio.d)
import    core.stdc.stdio   (/snap/ldc2/x1/bin/../include/d/core/stdc/stdio.d)
import    core.stdc.stdint  (/snap/ldc2/x1/bin/../include/d/core/stdc/stdint.d)
import    core.stdc.stddef  (/snap/ldc2/x1/bin/../include/d/core/stdc/stddef.d)
import    core.stdc.signal  (/snap/ldc2/x1/bin/../include/d/core/stdc/signal.d)
import    core.stdc.wchar_  (/snap/ldc2/x1/bin/../include/d/core/stdc/wchar_.d)
import    core.stdc.config  (/snap/ldc2/x1/bin/../include/d/core/stdc/config.d)
import    core.stdc.stdarg  (/snap/ldc2/x1/bin/../include/d/core/stdc/stdarg.d)
import    core.stdc.time    (/snap/ldc2/x1/bin/../include/d/core/stdc/time.d)
import    core.sys.posix.sys.types  (/snap/ldc2/x1/bin/../include/d/core/sys/posix/sys/types.d)
import    core.sys.posix.config (/snap/ldc2/x1/bin/../include/d/core/sys/posix/config.d)
import    std.typecons  (/snap/ldc2/x1/bin/../include/d/std/typecons.d)
import    std.meta  (/snap/ldc2/x1/bin/../include/d/std/meta.d)
import    std.traits    (/snap/ldc2/x1/bin/../include/d/std/traits.d)
import    std.typetuple (/snap/ldc2/x1/bin/../include/d/std/typetuple.d)
import    std.stdiobase (/snap/ldc2/x1/bin/../include/d/std/stdiobase.d)
import    std.range.primitives  (/snap/ldc2/x1/bin/../include/d/std/range/primitives.d)
import    core.stdc.errno   (/snap/ldc2/x1/bin/../include/d/core/stdc/errno.d)
import    core.stdc.string  (/snap/ldc2/x1/bin/../include/d/core/stdc/string.d)
import    std.exception (/snap/ldc2/x1/bin/../include/d/std/exception.d)
import    std.range (/snap/ldc2/x1/bin/../include/d/std/range/package.d)
import    std.range.interfaces  (/snap/ldc2/x1/bin/../include/d/std/range/interfaces.d)
import    std.array (/snap/ldc2/x1/bin/../include/d/std/array.d)
import    std.functional    (/snap/ldc2/x1/bin/../include/d/std/functional.d)
import    std.algorithm (/snap/ldc2/x1/bin/../include/d/std/algorithm/package.d)
import    std.algorithm.comparison  (/snap/ldc2/x1/bin/../include/d/std/algorithm/comparison.d)
import    std.algorithm.iteration   (/snap/ldc2/x1/bin/../include/d/std/algorithm/iteration.d)
import    std.algorithm.mutation    (/snap/ldc2/x1/bin/../include/d/std/algorithm/mutation.d)
import    std.algorithm.setops  (/snap/ldc2/x1/bin/../include/d/std/algorithm/setops.d)
import    std.algorithm.sorting (/snap/ldc2/x1/bin/../include/d/std/algorithm/sorting.d)
import    std.algorithm.searching   (/snap/ldc2/x1/bin/../include/d/std/algorithm/searching.d)
import    std.utf   (/snap/ldc2/x1/bin/../include/d/std/utf.d)
import    core.internal.string  (/snap/ldc2/x1/bin/../include/d/core/internal/string.d)
import    core.bitop    (/snap/ldc2/x1/bin/../include/d/core/bitop.d)
import    ldc.intrinsics    (/snap/ldc2/x1/bin/../include/d/ldc/intrinsics.di)
code      hello
/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
dnadlinger commented 7 years ago

Probably more GLIBC ABI (version) problems?

WebDrake commented 7 years ago

Looks very possible. I'll follow up with the snapcraft folks to see if they have any ideas.

WebDrake commented 7 years ago

LTO also fails on OpenSUSE Leap, for apparently similar reasons (I'll look more deeply some other time, just to confirm).