Bug 22630 – It is possible for VS to be installed and providing VC directory without VC libraries being installed
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2021-12-26T17:07:05Z
Last change time
2021-12-28T01:42:03Z
Keywords
pull
Assigned to
No Owner
Creator
Richard Cattermole
Comments
Comment #0 by alphaglosined — 2021-12-26T17:07:05Z
As of:
VS 2022
dmd 2.098.1 but may also effect going back to 2.091 as per issues 22525 and 21867.
Known environment to cause this:
For VS install with just F#.
During installer of dmd select MinGW.
During linking it is known that:
/LIBPATH:"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\lib\amd64"
will be added.
It will error with:
lld-link: error: could not open 'libcmt.lib': no such file or directory
Directory that does exist:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC
But not:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\lib
This may be fixable by changing getVCLibDir to check before returning that the path returned actually exists and not just return whatever it thinks should be the location.
Comment #1 by alphaglosined — 2021-12-26T17:28:44Z
We have a confirmed fix:
const(char)* getVCLibDir(bool x64) const
{
const(char)* proposed;
if (VCToolsInstallDir !is null)
proposed = FileName.combine(VCToolsInstallDir, x64 ? r"lib\x64" : r"lib\x86");
else if (VCInstallDir !is null)
proposed = FileName.combine(VCInstallDir, x64 ? r"lib\amd64" : "lib");
return FileName.exists(proposed) ? proposed : null;
}
Comment #2 by dlang-bot — 2021-12-27T21:08:18Z
@rikkimax created dlang/dmd pull request #13464 "fix issue 22630 - It is possible for VS to be installed and providing…" fixing this issue:
- fix issue 22630 - It is possible for VS to be installed and providing VC directory without VC libraries being installed
https://github.com/dlang/dmd/pull/13464
Comment #3 by dlang-bot — 2021-12-28T01:42:03Z
dlang/dmd pull request #13464 "fix issue 22630 - It is possible for VS to be installed and providing…" was merged into stable:
- e85775f98724312d349594338982496f95bbd226 by rikki cattermole:
fix issue 22630 - It is possible for VS to be installed and providing VC directory without VC libraries being installed
https://github.com/dlang/dmd/pull/13464