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

Attempting to build the same project with LDC 1.25.1 vs 1.26.0-beta1 results in a linker error #3700

Closed
GavinRay97 opened this issue Apr 14, 2021 · 5 comments

Comments

@GavinRay97
Copy link

GavinRay97 commented Apr 14, 2021

The strange thing is that the file it says doesn't exist, actually does, and there are no permissions issues.

Maybe a problem with the length of the directory name in total?

1.25.1
image

1.26.0-beta1
image

Here's a video of me deleting the dub packages appdata folder and rebuilding, and showing that the file does indeed exist where it says it doesn't (both with ls and visually):

ZZs1va5j36.mp4

Hope this is useful -- thank you! =)

@kinke
Copy link
Member

kinke commented Apr 14, 2021

Hi,

Maybe a problem with the length of the directory name in total?

Yes, most likely the 6 additional -beta1 chars pushing it over the limit; we've just had similar Windows long-path issues with dub at work. If link.exe doesn't support the \\?\ prefix for paths > 260 chars, there's nothing LDC can do.

@GavinRay97
Copy link
Author

GavinRay97 commented Apr 15, 2021

Ouch.

Let me do some more testing on this. I googled, and there's a registry value LongPathsEnabled which disables the 260 character path limit:

https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

I went to set this value to 1, but found it was already set to that:
image

So it can't be that 🤔

Let me try to build some other programs, or see if I can somehow narrow down what is causing this.
Any tips for debugging root cause of this -- or is this not even a LDC issue, but rather a link.exe one?

Thank you for all your hard work, it's much appreciated =)

@GavinRay97
Copy link
Author

GavinRay97 commented Apr 15, 2021

Ah, once you mentioned the LINK.exe thing, I tried this in dub.json:

{
  "dflags": ["-linker=lld-link"],
}

Problem gone. Superior LLVM toolchain saves the day -- lld is faster & has better errors anyways! 😅
Should have thought of that earlier.

I'm not sure if I would consider it solved ha, but it's not longer a problem at least 👍

image

@kinke
Copy link
Member

kinke commented Jun 9, 2021

I've hit this again (with a path significantly shorter than 260 chars); link.exe does support \\?\ prefixes, so LDC could accommodate for the ridiculous MS linker limitation (edit: nope, it doesn't). Unfortunately, that still wouldn't prevent dub from superfluously rebuilding such projects every time: dlang/dub#2143

@kinke
Copy link
Member

kinke commented Jun 18, 2021

With dlang/dub#2144 and #3756, the bundled dub now supports paths up to 260 chars (absolute, normalized), independent from the current working directory when invoking dub. I expect this to fix almost all cases. As the MS linker doesn't support longer paths, we cannot do anything from the LDC side - we already have -link-internally and -linker=lld-link etc.

@kinke kinke closed this as completed Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants