Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to link on linux #41

Open
Heromyth opened this issue Jan 30, 2019 · 1 comment
Open

Failed to link on linux #41

Heromyth opened this issue Jan 30, 2019 · 1 comment
Labels

Comments

@Heromyth
Copy link

OS: Linux Mint 19.1 Cinnamon
Compiler: DMD 2.084
Command line: dub run --compiler=dmd -a=x86_64 -b=debug

Test code:

import std.stdio;
import stdx.data.json;

void main() {
    // JSONValue value = toJSONValue(`{"name": "D", "kind": "language"}`);
}

Error message:

Linking...
.dub/build/application-debug-linux.posix-x86_64-dmd_2084-5FD92AF6B8B9BBBDE0C983C552F81BF8/demo.o: In function `_D15taggedalgebraic__T15TaggedAlgebraicTS4stdx4data4json5value9JSONValue12PayloadUnionZQCn11__xopEqualsFKxSQEb__TQDnTQCzZQDvKxQuZb':
source/app.d:(.text._D15taggedalgebraic__T15TaggedAlgebraicTS4stdx4data4json5value9JSONValue12PayloadUnionZQCn11__xopEqualsFKxSQEb__TQDnTQCzZQDvKxQuZb[_D15taggedalgebraic__T15TaggedAlgebraicTS4stdx4data4json5value9JSONValue12PayloadUnionZQCn11__xopEqualsFKxSQEb__TQDnTQCzZQDvKxQuZb]+0x20): undefined reference to `_D15taggedalgebraic__T15TaggedAlgebraicTS4stdx4data4json5value9JSONValue12PayloadUnionZQCn__T8opEqualsTxSQDz__TQDlTQCxZQDtTxQuZQBiMxFKxQBfZb'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
dmd failed with exit code 1.

By the way:

  • It's ok while running dub run --compiler=dmd -a=x86_64 -b=debug.
  • It's ok while using ldc 2.083.
  • It's ok while uncommenting in above main().
  • It's ok in debug mode for DMD 2.084 and LDC2 in my another project and failed in release mode.
@ghost ghost added the bug label Jan 30, 2019
@FeepingCreature
Copy link

I ran into the same issue. The relevant DMD bug is https://issues.dlang.org/show_bug.cgi?id=21235 and somewhat https://issues.dlang.org/show_bug.cgi?id=19091 - or rather, as I understand it, 19091 turns the compiler bug of 21235 into a linker error.

I hacked around it locally by copying std.data.json and taggedalgebraic into my library and making opEquals nontemplated, thus sidestepping the issue. But that can't be upstreamed in taggedalgebraic because I had to disable a bunch of unittests to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants