Bug 14871 – Linker errors with 2.068.0-rc1

Status
RESOLVED
Resolution
WONTFIX
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-05T09:08:00Z
Last change time
2015-08-09T09:26:10Z
Keywords
industry, link-failure, pull
Assigned to
nobody
Creator
briancschott
See also
https://issues.dlang.org/show_bug.cgi?id=846, https://issues.dlang.org/show_bug.cgi?id=14828

Comments

Comment #0 by briancschott — 2015-08-05T09:08:09Z
While testing 2.068.0-rc1 against some EMSI internal code as well as a development version of DCD I ran into some linking issues. It seems that the linker is trying to resolve some symbols whose names end with "__arrayZ" and "__assertFiZv". These symbol names seem to always be at module scope. Example error messages: /path_partially_redacted/ext/containers/src/containers/unrolledlist.d:445: undefined reference to `_D10containers12unrolledlist8__assertFiZv' bin/dcd-server.o: In function `_D3std12experimental9allocator15building_blocks15stats_collector232__T14StatsCollectorTS3std12experimental9allocator15building_blocks6region137__T6RegionTS3std12experimental9allocator10mallocator10MallocatorVki16VE3std8typecons43__T4FlagVAyaa13_67726f77446f776e7761726473Z4Flagi0Z6RegionVmi1024Vmi0Z14StatsCollector6defineFAyaAAyaXAya': msgpack-d/src/msgpack.d:(.text._D3std12experimental9allocator15building_blocks15stats_collector232__T14StatsCollectorTS3std12experimental9allocator15building_blocks6region137__T6RegionTS3std12experimental9allocator10mallocator10MallocatorVki16VE3std8typecons43__T4FlagVAyaa13_67726f77446f776e7761726473Z4Flagi0Z6RegionVmi1024Vmi0Z14StatsCollector6defineFAyaAAyaXAya+0x83): undefined reference to `_D3std12experimental9allocator15building_blocks15stats_collector7__arrayZ' It should be possible to reproduce part of the error with a checkout of DCD at this version: https://github.com/Hackerpilot/DCD/tree/7724ab9dc63221d383dfcfdf78429c570eeba60c (Remember to run `git submodule update --init --recursive after checking out)
Comment #1 by k.hara.pg — 2015-08-05T10:13:38Z
Due to fix issue 14828 and related, 2.068.0-rc1 has introduced a change to the generation of internal symbols __array, __assert, and __unittest_fail. I have opposite stance for the change, but it's rejected. The PR that contains the discussion: https://github.com/D-Programming-Language/dmd/pull/4851 If you want to get more detailed information, please wait the reply from Walter or Martin.
Comment #2 by k.hara.pg — 2015-08-05T10:48:53Z
Essentially the change was unnecessary to fix regressions, but just added to make compiler implementation 'simple'. I think it was not good decision.
Comment #3 by code — 2015-08-05T11:19:11Z
The issues is that you're not compiling the std.experimental.allocator.building_blocks modules. The fix is straightforward. - containers/src/std/experimental/allocator/mallocator.d\ - containers/src/std/experimental/allocator/package.d\ - containers/src/std/experimental/allocator/common.d\ - containers/src/std/experimental/allocator/gc_allocator.d\ - containers/src/std/experimental/allocator/building_blocks/allocator_list.d\ - containers/src/std/experimental/allocator/typed.d\ + $(shell find containers/src/std/experimental/allocator -name "*.d")\ We fixed 2 regressions by using a simpler mechanism to emit helper functions. Now this requires you to link against all modules you use, where previously you could sometimes get away without linking. https://github.com/D-Programming-Language/dmd/pull/4851
Comment #4 by briancschott — 2015-08-05T19:06:36Z
I was able to get all of my code to build and link. There really needs to be something in the changelog that warns people about this.
Comment #5 by kozzi11 — 2015-08-06T07:01:34Z
> The issues is that you're not compiling the > std.experimental.allocator.building_blocks modules. WTF? I hope this will be fixed before 2.068 will be released?
Comment #6 by kozzi11 — 2015-08-06T07:02:45Z
I mean on compiler side. Because this kind of error its really stupid. And it breaks code.
Comment #7 by kozzi11 — 2015-08-06T07:04:28Z
Not code but, it makes no clue what exactly is wrong. I can see poor soul on SO asking what is wrong.
Comment #8 by wyrlon — 2015-08-06T09:24:06Z
Just for statistics... I was hit by this compiler regression as well, in my own code-base, not experimental/allocator. Since we normally are quite vary about breaking code, I'm surprised this change was allowed in. I did manage to solve it on my own, was just about to raise a ticket but found the duplicate.
Comment #9 by k.hara.pg — 2015-08-07T02:45:36Z
I open a compiler fix not to break any user project builds. https://github.com/D-Programming-Language/dmd/pull/4867
Comment #10 by bugzilla — 2015-08-07T06:44:53Z
Please read the discussion here: https://github.com/D-Programming-Language/dmd/pull/4851 The general idea is, if your code imports A, then you must link with A.obj. Note that Kenji, Martin and I discussed this for a while and did not reach a consensus.
Comment #11 by briancschott — 2015-08-07T21:35:22Z
I saw that there is an addition to the changelog that will help people fix this problem. I think that warning is good enough, so I'm willing to close this issue.
Comment #12 by kozzi11 — 2015-08-08T06:53:42Z
Changlog comment is better than nothing
Comment #13 by bugzilla — 2015-08-09T09:26:10Z
Resolved as "wontfix".