www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Weird linker errors

reply Kjartan F. Kvamme <forbjok gmail.com> writes:
I asked about this in the IRC channel, and was advised to ask 
about it here as well.

There's this weird linker error that's been bugging me every time 
I run into it for a year or two, so I finally got around to 
putting together a minimal reproduction of the issue.

Basically, under specific circumstances, I'm getting linker 
errors about "taggedalgebraic", a dependency of "std_data_json" 
which is used in the projects I'm running into this with. 
However, I highly suspect the issue is a DUB or compiler issue 
rather than the fault of taggedalgebraic.

I'm still not sure what the exact trigger for it is, but I 
managed to put together a fairly minimal reproduction by just 
shaving away code a little bit at a time from the original 
projects I was having this issue with.

It happens _only_ in RELEASE builds, not debug builds, and 
therefore has basically forced me to build some of my projects in 
debug mode for production use.

The errors happen with both DMD (v2.083.0) and LDC2 (v1.12.0), 
and both on Windows and Linux (64-bit Arch Linux). (slightly 
different messages, but basically the same error)
It's also not new. I don't remember exactly when I first 
encountered this, but it's definitely been around for a while - 
most likely at least 1-2 years.

Repository with minimal reproduction of issue:
https://github.com/forbjok/dlang-weird-linker-errors-repro

The error messages I'm getting are included in the repository's 
README.txt.

Perhaps someone can help me shed some light on this, and where 
(if at all) I should file a bug about this?
Dec 02 2018
next sibling parent reply kinke <noone nowhere.com> writes:
This sounds very much like 
https://issues.dlang.org/show_bug.cgi?id=17712. Please check if 
you can get it to work with `-allinst`.
Dec 02 2018
next sibling parent Kjartan F. Kvamme <forbjok gmail.com> writes:
On Sunday, 2 December 2018 at 19:05:13 UTC, kinke wrote:
 This sounds very much like 
 https://issues.dlang.org/show_bug.cgi?id=17712. Please check if 
 you can get it to work with `-allinst`.
Where do I put -allinst? If I do "dub build -b release -allinst" it just says "Unsupported architecture: llinst".
Dec 02 2018
prev sibling parent Kjartan F. Kvamme <forbjok gmail.com> writes:
On Sunday, 2 December 2018 at 19:37:51 UTC, Kjartan F. Kvamme 
wrote:
 Where do I put -allinst?
Never mind, figured it out. I put it in "dflags" in dub.json. On Sunday, 2 December 2018 at 19:05:13 UTC, kinke wrote:
 This sounds very much like 
 https://issues.dlang.org/show_bug.cgi?id=17712. Please check if 
 you can get it to work with `-allinst`.
Tested it, and no, it still doesn't work. With -allinst in "dlags", I just get a lot more linker errors.
Dec 02 2018
prev sibling parent reply John Colvin <john.loughran.colvin gmail.com> writes:
On Sunday, 2 December 2018 at 15:27:59 UTC, Kjartan F. Kvamme 
wrote:
 I asked about this in the IRC channel, and was advised to ask 
 about it here as well.

 [...]
My bet is specifically on the -debug flag being necessary, and it being the same situation as https://github.com/CyberShadow/Digger/issues/37
Dec 02 2018
parent reply Kjartan F. Kvamme <forbjok gmail.com> writes:
On Sunday, 2 December 2018 at 21:41:17 UTC, John Colvin wrote:
 On Sunday, 2 December 2018 at 15:27:59 UTC, Kjartan F. Kvamme 
 wrote:
 I asked about this in the IRC channel, and was advised to ask 
 about it here as well.

 [...]
My bet is specifically on the -debug flag being necessary, and it being the same situation as https://github.com/CyberShadow/Digger/issues/37
Interesting. If it is the bug mentioned in that issue (https://issues.dlang.org/show_bug.cgi?id=15985) and it's been known about for this long, how come it hasn't been fixed yet?
Dec 02 2018
parent bauss <jj_1337 live.dk> writes:
On Sunday, 2 December 2018 at 23:14:05 UTC, Kjartan F. Kvamme 
wrote:
 On Sunday, 2 December 2018 at 21:41:17 UTC, John Colvin wrote:
 On Sunday, 2 December 2018 at 15:27:59 UTC, Kjartan F. Kvamme 
 wrote:
 I asked about this in the IRC channel, and was advised to ask 
 about it here as well.

 [...]
My bet is specifically on the -debug flag being necessary, and it being the same situation as https://github.com/CyberShadow/Digger/issues/37
Interesting. If it is the bug mentioned in that issue (https://issues.dlang.org/show_bug.cgi?id=15985) and it's been known about for this long, how come it hasn't been fixed yet?
Because A: Not enough people are affected by the bug and thus it's not prioritized over other issues. B: Nobody has decided to work on it. C: There is no clear solution to the problem.
Dec 03 2018