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

BAZEL_VS / BAZEL_VC don't account for custom install locations well. #11259

Closed
laramiel opened this issue Apr 30, 2020 · 2 comments
Closed

BAZEL_VS / BAZEL_VC don't account for custom install locations well. #11259

laramiel opened this issue Apr 30, 2020 · 2 comments
Assignees
Labels
area-Windows Windows-specific issues and feature requests P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@laramiel
Copy link

Bazel fails to find vc installation.

I'm trying to use bazel with a non-standard ms_buildtools install location, and it fails to find all the tools.
Specifically, I've installed ms_buildtools like this:

--locale en-US --installPath C:\BuildTools --config config.txt

config.txt:
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.CoreBuildTools",
"Microsoft.VisualStudio.Workload.MSBuildTools",
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.CoreBuildTools",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.TestTools.BuildTools",
"Microsoft.Net.Component.4.8.SDK",
"Microsoft.Net.Component.4.6.1.TargetingPack",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Workload.VCTools"
]
}

When running bazel build, it doesn't really matter what I set BAZEL_VC to, bazel fails to find the file VCVARSALL.BAT

in this configuration VCVARSALL.bat lives here:

C:\BuildTools\VC\Auxiliary\Build

while cl.exe, etc live here (among other places)

C:\BuildTools\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64

The windows_cc_configure.bzl file knows about this, but it looks at the path to determine the version. Since BuildTools does not include the magic string 2019, this fails.

It seems more reasonable to match against the file layout.

@laramiel laramiel changed the title BAZEL_VS / BAZEL_VC don' BAZEL_VS / BAZEL_VC don't account for custom install locations well. Apr 30, 2020
@jin jin added area-Windows Windows-specific issues and feature requests untriaged labels Apr 30, 2020
@laszlocsomor
Copy link
Contributor

laszlocsomor commented Apr 30, 2020

Looks like windows_cc_configure.bzl needs to be fixed.

Short-term, can you try creating a junction C:\BuildTools\2017\VC --> C:\BuildTools\VC and setting BAZEL_VC=C:\BuildTools\2017\VC? Not sure it will work, but worth giving it a try.

@tomlu
Copy link
Contributor

tomlu commented May 5, 2020

We hit this as well. I solved it by pulling out the generated BUILD file from the local_cc_config, fixing the paths, then checking it in. VCVARSALL.bat isn't really needed then since it's only used during workspace configuration.

@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
@philwo philwo added P1 I'll work on this now. (Assignee required) type: bug and removed untriaged labels Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Windows Windows-specific issues and feature requests P1 I'll work on this now. (Assignee required) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants