Thread overview
Getting error in dmd testsuite
Aug 26, 2017
Thomas Mader
Aug 27, 2017
Joakim
Dec 28, 2017
Thomas Mader
Jan 06, 2019
Thomas Mader
August 26, 2017
Hello,

I am building ldc on Nix (https://nixos.org/nix/) but keep getting an error while running the cppa.d test from the dmd testsuite (https://github.com/ldc-developers/dmd-testsuite).

1588:  ... runnable/cppa.d                 -L-lstdc++ (-g) -O
1588: Test failed.  The logged output:
1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/bin/ldmd2 -conf= -m64 -Irunnable  -L-lstdc++  -od/tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable -of/tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0 runnable/cppa.d /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppb.cpp.o
1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o: In function `_Dmain':
1588: runnable/cppa.d:(.text._Dmain[_Dmain]+0x49f): undefined reference to `int foo15372<int>(int)'
1588: runnable/cppa.d:(.text._Dmain[_Dmain]+0x4b2): undefined reference to `Foo15802<int>::boo(int)'
1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa6C131616__vtblZ[_D4cppa6C131616__vtblZ]+0x0): undefined reference to `C13161::dummyfunc()'
1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa4Test6__vtblZ[_D4cppa4Test6__vtblZ]+0x0): undefined reference to `C13161::dummyfunc()'
1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa7C13161a6__vtblZ[_D4cppa7C13161a6__vtblZ]+0x0): undefined reference to `C13161a::dummyfunc()'
1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa5Testa6__vtblZ[_D4cppa5Testa6__vtblZ]+0x0): undefined reference to `C13161a::dummyfunc()'
1588: collect2: error: ld returned 1 exit status
1588: Error: /nix/store/df84hkmhrhx1c2zpvrhmk6aprhlzkasx-gcc-wrapper-6.4.0/bin/gcc failed with status: 1
1588:
1588:
1588: ==============================
1588: Test failed: expected rc == 0, exited with rc == 1
1588:
1588: make[2]: *** [Makefile:335: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa.d.out] Error 1

Apart from that all other tests pass.
Any ideas?

It's running on Linux with gcc 6.4.0.
August 27, 2017
On Saturday, 26 August 2017 at 21:59:10 UTC, Thomas Mader wrote:
> Hello,
>
> I am building ldc on Nix (https://nixos.org/nix/) but keep getting an error while running the cppa.d test from the dmd testsuite (https://github.com/ldc-developers/dmd-testsuite).
>
> 1588:  ... runnable/cppa.d                 -L-lstdc++ (-g) -O
> 1588: Test failed.  The logged output:
> 1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/bin/ldmd2 -conf= -m64 -Irunnable  -L-lstdc++  -od/tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable -of/tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0 runnable/cppa.d /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppb.cpp.o
> 1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o: In function `_Dmain':
> 1588: runnable/cppa.d:(.text._Dmain[_Dmain]+0x49f): undefined reference to `int foo15372<int>(int)'
> 1588: runnable/cppa.d:(.text._Dmain[_Dmain]+0x4b2): undefined reference to `Foo15802<int>::boo(int)'
> 1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa6C131616__vtblZ[_D4cppa6C131616__vtblZ]+0x0): undefined reference to `C13161::dummyfunc()'
> 1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa4Test6__vtblZ[_D4cppa4Test6__vtblZ]+0x0): undefined reference to `C13161::dummyfunc()'
> 1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa7C13161a6__vtblZ[_D4cppa7C13161a6__vtblZ]+0x0): undefined reference to `C13161a::dummyfunc()'
> 1588: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa_0.o:(.data.rel.ro._D4cppa5Testa6__vtblZ[_D4cppa5Testa6__vtblZ]+0x0): undefined reference to `C13161a::dummyfunc()'
> 1588: collect2: error: ld returned 1 exit status
> 1588: Error: /nix/store/df84hkmhrhx1c2zpvrhmk6aprhlzkasx-gcc-wrapper-6.4.0/bin/gcc failed with status: 1
> 1588:
> 1588:
> 1588: ==============================
> 1588: Test failed: expected rc == 0, exited with rc == 1
> 1588:
> 1588: make[2]: *** [Makefile:335: /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppa.d.out] Error 1
>
> Apart from that all other tests pass.
> Any ideas?
>
> It's running on Linux with gcc 6.4.0.

That module tests linking with C++ files, looks like you have some symbols that don't match up.  That's weird, because those normally work with gcc.  For each of them, use the readelf command from binutils to compare the symbols generated and see how they differ.  For example,

readelf -sW /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppb.cpp.o |grep foo15372

Then run the same command on the D side, ie for cppa_0.o, and compare the symbols.

File a bug on the ldc github if you can't figure it out:

https://github.com/ldc-developers/ldc/issues
December 28, 2017
On Sunday, 27 August 2017 at 14:04:18 UTC, Joakim wrote:
> That module tests linking with C++ files, looks like you have some symbols that don't match up.  That's weird, because those normally work with gcc.  For each of them, use the readelf command from binutils to compare the symbols generated and see how they differ.  For example,
>
> readelf -sW /tmp/nix-build-ldc-1.3.0.drv-0/build/dmd-testsuite/runnable/cppb.cpp.o |grep foo15372
>
> Then run the same command on the D side, ie for cppa_0.o, and compare the symbols.
>
> File a bug on the ldc github if you can't figure it out:
>
> https://github.com/ldc-developers/ldc/issues

gcc does not create the symbol at all on NixOS. I already created an issue for NixOS: https://github.com/NixOS/nixpkgs/issues/28896

I am not supposed to ask here but maybe someone knows about problems with gcc?

January 06, 2019
On Thursday, 28 December 2017 at 14:45:54 UTC, Thomas Mader wrote:
> gcc does not create the symbol at all on NixOS. I already created an issue for NixOS: https://github.com/NixOS/nixpkgs/issues/28896
>
> I am not supposed to ask here but maybe someone knows about problems with gcc?

I finally found out why the symbols are missing. See https://issues.dlang.org/show_bug.cgi?id=19553#c3