Link error triggered by `dub test` but not by `dub build --unittest`

Per Nordlöw per.nordlow at gmail.com
Tue Jun 16 12:21:26 UTC 2020


Inside

https://github.com/nordlow/phobos-next/

doing

    dub build --compiler=dmd --build=unittest

works but

    dub test --compiler=dmd

fails as

Generating test runner configuration 'phobos-next-test-library' 
for 'library' (library).
Performing "unittest" build using /usr/bin/dmd for x86_64.
phobos-next ~master: building configuration 
"phobos-next-test-library"...
Linking...
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D268TypeInfo_S4core8internal8lifetime__T10emplaceRefTS3nxt13dynamic_array__T12DynamicArrayTSQBm22sso_hashmap_or_hashset__T15SSOHashMapOrSetTkTCQDlQBz20__unittest_L1781_C15FNaNeZ1VVnnTSQFa7digestx3fnv__T3FNVVmi64Vbi1ZQoVki1Vki2Vki1ZQEf1TVQCfnTkZQGmTQHnTG2QGhZQIkFKQIcKQpZ1S6__initZ: error: undefined reference to '_D6object10_xopEqualsFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D270TypeInfo_S4core8internal8lifetime__T10emplaceRefTS3nxt13dynamic_array__T12DynamicArrayTSQBm22sso_hashmap_or_hashset__T15SSOHashMapOrSetTkTCQDlQBz20__unittest_L1837_C14FNaNbNfZ1VVnnTSQFc7digestx3fnv__T3FNVVmi64Vbi1ZQoVki1Vki2Vki1ZQEh1TVQCfnTkZQGoTQHpTG2QGjZQImFKQIeKQpZ1S6__initZ: error: undefined reference to '_D6object10_xopEqualsFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D124TypeInfo_S3std8typecons__T5TupleTSQy5range__T11SortedRangeTAiVAyaa5_61203c2062VEQCsQBv18SortedRangeOptionsi0ZQCmTQDcTQDgZQDr6__initZ: error: undefined reference to '_D6object7_xopCmpFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D109TypeInfo_S3std8typecons__T5TupleTiTS3nxt12algorithm_ex__T17forwardDifferenceTAiZQxFQgZ17ForwardDifferenceZQDc6__initZ: error: undefined reference to '_D6object7_xopCmpFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D49TypeInfo_S3std8typecons__T5TupleTC8TypeInfoTPvZQv6__initZ: error: undefined reference to '_D6object7_xopCmpFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D52TypeInfo_S3std8typecons__T5TupleTC8TypeInfoTPG32hZQy6__initZ: error: undefined reference to '_D6object7_xopCmpFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D3nxt5bound22BoundOverflowException6__vtblZ: error: undefined reference to '_D6object9Throwable8toStringMxFMDFMxAaZvZv'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D3nxt6cyclic16CyclicRangeError6__vtblZ: error: undefined reference to '_D6object9Throwable8toStringMxFMDFMxAaZvZv'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D46TypeInfo_S3nxt6cyclic__T11CyclicArrayTiVmi0ZQu6__initZ: error: undefined reference to '_D6object10_xopEqualsFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D70TypeInfo_S3nxt6cyclic__T11CyclicArrayTSQBdQBc13structBug5920Vmi256ZQBr6__initZ: error: undefined reference to '_D6object10_xopEqualsFMxPvMxQeZb'
.dub/build/phobos-next-test-library-unittest-linux.posix-x86_64-dmd_2092-4171FC1A47BBEE27E965310B42F6CCF0/phobos-next-test-library.o:src/nxt/zio.d:_D3nxt7variant23LightAlgebraicException6__vtblZ: error: undefined reference to '_D6object9Throwable8toStringMxFMDFMxAaZvZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
/usr/bin/dmd failed with exit code 1.

All the linker errors originate from zio.d but zio.d has its 
unittests disabled so how come this fails to link?

And how come

     dub build --unittest

passes

when

     dub test

doesn't?

I'm sitting on Ubuntu 20.04 x64.


More information about the Digitalmars-d-learn mailing list