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

Centralize and improve Windows prereq checks #1251

Closed
danmoseley opened this issue Jan 2, 2020 · 5 comments · Fixed by #49593
Closed

Centralize and improve Windows prereq checks #1251

danmoseley opened this issue Jan 2, 2020 · 5 comments · Fixed by #49593

Comments

@danmoseley
Copy link
Member

danmoseley commented Jan 2, 2020

I got the missing DIA SDK error when first building on my laptop just now:

Error: DIA SDK is missing at "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\DIA SDK". This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\" but rather at the install location of previous Visual Studio version. The workaround is to copy the DIA SDK folder from the Visual Studio install location of the previous version to "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\" and then build.
Visual Studio Express does not include the DIA SDK. You need Visual Studio 2017 or 2019 (Community is free).

In the current machine, I have 15.9.11 Preview 1 and 16.5.0 Preview 2. I am building in the VS 2019 prompt, where VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\. However the single DIA SDK folder is under the VS 2017 prompt's VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise.

I copied it from there to solve the problem, so the message may be fully accurate. However, I have seen this prompt at least 3 years ago, so it is not clear that this will solve itself. Can we look in more places for it, to remove this stumbling block when building the repo the first time?

Perhaps it could look under C:\Program Files (x86)\Microsoft Visual Studio for DIA SDK if it can't find one under VSINSTALLDIR?

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jan 2, 2020
@danmoseley
Copy link
Member Author

danmoseley commented Jan 2, 2020

Hmm, this was likely because I did not have the C++ desktop workload installed for VS2019, but I did for VS2017 since after xcopying the folder, I got

BUILD: Using environment: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\Tools\\..\..\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
The system cannot find the path specified.
BUILD: Regenerating the Visual Studio solution
CMake Error at CMakeLists.txt:6 (project):
  Generator

    Visual Studio 16 2019

  could not find any instance of Visual Studio.

Perhaps the takeaway here is could we display a message suggesting the C++ desktop development pack is missing, rather than the above messages.

@danmoseley danmoseley changed the title Look harder for DIA SDK Add explicit diagnostic for missing C++ desktop development workload Jan 2, 2020
@BruceForstall
Copy link
Member

Can this really be a bug as the message states? ("This is due to a bug in the Visual Studio installer.") That message was added years ago.

I like the idea of being more specific about checking that the required prereqs are installed; we should verify what we can about the pre-requisites documented here: https://github.com/dotnet/runtime/blob/master/docs/workflow/requirements/windows-requirements.md. E.g., if you ask for an arm64 Windows build, check that the arm64 compilers are installed, and give a better error message if they aren't.

@danmoseley
Copy link
Member Author

Copied from my comment in the PR:

Incidentally, we are happily building in a VS2017 prompt, although we claim that VS2019 is required. (Note, the core-setup repo did not require VS2019 before)

src\installer\corehost\build.cmd
src\coreclr\setup_vs_tools.cmd
src\libraries\Native\build-native.cmd

all use vswhere and need updating to require VS2019.

Also it looks like eng\common\tools.ps1 can help verify that VS2019 is installed, if we set tools.vs.version in eng\global.json. It can also verify the specific workloads are present, see "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -? and tools.ps1.

@danmoseley
Copy link
Member Author

Summarizing comments on the PR and above

  1. Centralize prerequisite checks so they are done in one place and at the start of the build.
  2. On Windows, verify VS2019 command prompt, and all the necessary workloads
  3. Exception: only require DIA SDK for the CLR product build (for dactablegen tool)

It looks like a mechanism might already exist for 1 and 2, based on the JSON output of vswhere.exe

if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs }
$args = @('-latest', '-prerelease', '-format', 'json', '-requires', 'Microsoft.Component.MSBuild', '-products', '*')
if (Get-Member -InputObject $vsRequirements -Name 'version') {
$args += '-version'
$args += $vsRequirements.version
}
if (Get-Member -InputObject $vsRequirements -Name 'components') {
foreach ($component in $vsRequirements.components) {
$args += '-requires'
$args += $component
}
}

@danmoseley danmoseley changed the title Add explicit diagnostic for missing C++ desktop development workload Centralize and improve Windows prereq checks Jan 3, 2020
@danmoseley
Copy link
Member Author

Ideally what we do here would not further cement our build dependency on VS (dotnet/arcade#64). The prereq's should be for what we need.

@jashook jashook removed the untriaged New issue has not been triaged by the area owner label Jul 13, 2020
@jashook jashook added this to the Future milestone Jul 17, 2020
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 14, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 14, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants