February 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21604

          Issue ID: 21604
           Summary: LINK : fatal error LNK1104: cannot open file
                    'libucrt.lib'
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: installer
          Assignee: nobody@puremagic.com
          Reporter: destructionator@gmail.com

A user on discord was trying D for the first time and hit the libucrt file missing problem with dub (and -m32mscoff, -m64, but not with dmd -m32). They hinted that they came from WinForms which gave me a theory: they had Visual Studio installed for .net, but not the native SDK.

They got the Win 10 native SDK from Microsoft and it solved the problem.

I haven't proven this, but I suspect the problem came because the dmd installed looked for Visual Studio, found it, then tried to use its lib directory. However, since the VS install only had the C#/.net components, the library was missing.

With a fresh install, we should be able to reproduce and test that problem. The installer could also just try to build a hello world to self-test after installing and if it gets that error, also install the win 10 native sdk:

https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/

Or at least direct the user to do that themselves.


OR it could scan Visual Studio and see that the native libs are missing and instead of trying to use it just use the built-in lld-link or whatever. I don't know if that would work.


Anyway my system is in no state to do a clean test to reproduce the problem, and this user's problem is now solved, but I wanna put this up here to get fixed in the future.

--