www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21867] New: DMD fails to link after installing Visual Studio

https://issues.dlang.org/show_bug.cgi?id=21867

          Issue ID: 21867
           Summary: DMD fails to link after installing Visual Studio 2019
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zero vec4.xyz

DMD fails to link after installing Visual Studio 2019 Community (installing
only .NET components).

To clarify, I used dmd without VS before and I had no issue.

To reproduce on my machine I just need to create empty folder c:\Program Files
(x86)\Microsoft Visual Studio\2019\Community\VC

lld-link: error: could not open 'libcmt.lib': no such file or directory
Error: linker exited with status 1

Removing the folder fixes the issue.

LDC does not have this problem and it links fine.

dmd --version
DMD64 D Compiler v2.096.1-dirty

Output of dmd -v:

With the folder (linking fails with above error)
c:\D\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj" /OUT:"app.exe" 
/DEFAULTLIB:phobos64 /DEBUG  /LIBPATH:"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\lib\amd64"
/LIBPATH:"C:\D\dmd2\windows\bin\..\lib64\mingw"

And without (links fine)
c:\D\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj" /OUT:"app.exe" 
/DEFAULTLIB:phobos64 /DEBUG  /LIBPATH:"c:\D\dmd2\windows\bin64\..\lib64\mingw"

--
Apr 27 2021