Bug 14942 – dmd linking error with SHA and SSSE3

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-08-20T21:15:00Z
Last change time
2016-02-04T14:09:18Z
Assigned to
nobody
Creator
chalucha

Comments

Comment #0 by chalucha — 2015-08-20T21:15:10Z
I have a strange problem with building vibe.d in debug[0] As I updated to dmd-2.068 and the problem remains, I tried to minimize the test case and here it is. Code: import std.digest.sha; void main() { SHA1 hash; hash.put(cast(ubyte)0); hash.finish(); } And now with commands generated by dub: dmd -c -oftest.o -debug -g -w app.d dmd -oftest test.o -L--no-as-needed -g Results in: test.o: In function `std.digest.sha.SHA!(512, 160).SHA._sharedStaticCtor330()': /opt/dmd-2.068/import/std/digest/sha.d:224: undefined reference to `std.internal.digest.sha_SSSE3.transformSSSE3(uint[5]*, const(ubyte[64])*)' In release, problem does not occur. It's also ok with ldc2-0.15.1 DMD version: v2.068.0 OS: Gentoo linux x86_64 CPU: i5-2500K SandyBridge (with SSSE3) Config [/opt/dmd-2.068/bin/dmd.conf]: [Environment] DFLAGS=-I/opt/dmd-2.068/import -L--export-dynamic -defaultlib=phobos2 -L--demangle=dlang [Environment32] DFLAGS=%DFLAGS% -L-L/opt/dmd-2.068/lib32 -L-rpath -L/opt/dmd-2.068/lib32 [Environment64] DFLAGS=%DFLAGS% -L-L/opt/dmd-2.068/lib64 -L-rpath -L/opt/dmd-2.068/lib64 [0] https://github.com/rejectedsoftware/vibe.d/issues/1097
Comment #1 by chalucha — 2015-08-20T21:21:18Z
linking output with -v switch: binary dmd version v2.068.0 config /opt/dmd-2.068/bin/dmd.conf gcc test.o -o test -g -m64 -Xlinker --no-as-needed -Xlinker --export-dynamic -Xlinker --demangle=dlang -L/opt/dmd-2.068/lib64 -Xlinker -rpath -Xlinker /opt/dmd-2.068/lib64 -lphobos2 -lpthread -lm -lrt test.o: In function `std.digest.sha.SHA!(512, 160).SHA._sharedStaticCtor330()': app.d:(.text._D3std6digest3sha20__T3SHAVii512Vii160Z3SHA20_sharedStaticCtor330FNbNiNfZv+0x45): undefined reference to `std.internal.digest.sha_SSSE3.transformSSSE3(uint[5]*, const(ubyte[64])*)'
Comment #2 by dlang-bugzilla — 2015-09-01T10:16:03Z
I can't reproduce this. What package did you install? What happens if you build D 2.068 from source (e.g. using Digger)?
Comment #3 by chalucha — 2015-09-01T21:20:19Z
I've tried it with the gentoo dlang overlay [1] There is not yet an ebuild for 2.068 so I tried that from binary package [2]. Thanks for pointing me to digger, I tested it with: ./digger build v2.068.1-b2 sudo ./digger install and it built! With ./digger build v2.068.0 it won't. When I tried to bisect it, it became strange as it was ok even with 2.068.0. So it seems to be something with the system configuration. When I manually passed the --conf pointing to diggers dmd.conf it was also ok. I guess it had to be something with the phobos lib. Maybe shared phobos lib used by gentoo ebuild mixed with static libs? So I unmerged all dlang ebuilds, checked bin and lib paths for remaining files and installed dmd manually from zip file. After that it builds ok, so problem solved. [1] https://github.com/gentoo/dlang/blob/master/dev-lang/dmd/dmd-2.067.1.ebuild [2] http://downloads.dlang.org/releases/2015/dmd.2.068.0.zip
Comment #4 by dlang — 2016-02-04T10:27:29Z
i can reproduce this on an up to date archlinux system: ws02% dub init -t vibe.d ugah Successfully created an empty project in '/home/yannick/code/d/test/ugah'. ws02% cd ugah ws02% ls dub.json public source views ws02% dub build --compiler=ldc Performing "debug" build using ldc for x86_64. vibe-d:utils 0.7.27: building configuration "library"... vibe-d:data 0.7.27: building configuration "library"... vibe-d:core 0.7.27: building configuration "libevent"... vibe-d:http 0.7.27: building configuration "library"... hvibe-d:diet 0.7.27: building configuration "library"... vibe-d:mail 0.7.27: building configuration "library"... vibe-d:mongodb 0.7.27: building configuration "library"... vibe-d:redis 0.7.27: building configuration "library"... vibe-d:web 0.7.27: building configuration "library"... vibe-d 0.7.27: building configuration "libevent"... ugah ~master: building configuration "application"... /usr/include/dlang/ldc/std/digest/sha.d:224: error: undefined reference to '_D3std8internal6digest9sha_SSSE314transformSSSE3FNaNbNiPG5kPxG64hZv' /usr/include/dlang/ldc/std/digest/sha.d:224: error: undefined reference to '_D3std8internal6digest9sha_SSSE314transformSSSE3FNaNbNiPG5kPxG64hZv' /usr/include/dlang/ldc/std/digest/sha.d:224: error: undefined reference to '_D3std8internal6digest9sha_SSSE314transformSSSE3FNaNbNiPG5kPxG64hZv' /usr/include/dlang/ldc/std/digest/sha.d:224: error: undefined reference to '_D3std8internal6digest9sha_SSSE314transformSSSE3FNaNbNiPG5kPxG64hZv' collect2: error: ld returned 1 exit status Error: /usr/sbin/gcc failed with status: 1 ldc failed with exit code 1. ws02% pacman -Q | grep ldc ldc 1:0.16.1-4 ws02% ldc --version LDC - the LLVM D compiler (0.16.1): based on DMD v2.067.1 and LLVM 3.7.1 Default target: x86_64-unknown-linux-gnu Host CPU: haswell http://dlang.org - http://wiki.dlang.org/LDC Registered Targets: aarch64 - AArch64 (little endian) aarch64_be - AArch64 (big endian) amdgcn - AMD GCN GPUs arm - ARM arm64 - ARM64 (little endian) armeb - ARM (big endian) bpf - BPF (host endian) bpfeb - BPF (big endian) bpfel - BPF (little endian) cpp - C++ backend hexagon - Hexagon mips - Mips mips64 - Mips64 [experimental] mips64el - Mips64el [experimental] mipsel - Mipsel msp430 - MSP430 [experimental] nvptx - NVIDIA PTX 32-bit nvptx64 - NVIDIA PTX 64-bit ppc32 - PowerPC 32 ppc64 - PowerPC 64 ppc64le - PowerPC 64 LE r600 - AMD GPUs HD2XXX-HD6XXX sparc - Sparc sparcel - Sparc LE sparcv9 - Sparc V9 systemz - SystemZ thumb - Thumb thumbeb - Thumb (big endian) x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 xcore - XCore ws02% dub --version DUB version 0.9.24+95-g20d74e8, built on Jan 5 2016
Comment #5 by dlang — 2016-02-04T10:34:53Z
sorry wrong issue tracker. this is a LDC or arch bug.