bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.98k stars 4.03k forks source link

Failure to Fetch VC Tools #13858

Open Caaslund opened 3 years ago

Caaslund commented 3 years ago

Description of the problem / feature request:

I attempted to use bazel to build GCR distroless images (repo), but when running the command bazel build //package_manager:dpkg_parser.par, I eventually hit the following error:

ERROR: Error fetching repository: Traceback (most recent call last):
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/cc_configure.bzl", line 122, column 36, in cc_autoconf_impl
                configure_windows_toolchain(repository_ctx)
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 784, column 35, in configure_windows_toolchain
                msvc_vars_x64 = _get_msvc_vars(repository_ctx, paths, "x64")
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 596, column 47, in _get_msvc_vars
                missing_tools = _find_missing_vc_tools(repository_ctx, vc_path, target_arch)
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 466, column 30, in _find_missing_vc_tools
                if not find_msvc_tool(repository_ctx, vc_path, tools[tool_name], target_arch):
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 445, column 44, in find_msvc_tool
                full_version = _get_vc_full_version(repository_ctx, vc_path)
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 427, column 34, in _get_vc_full_version
                return _get_latest_subversion(repository_ctx, vc_path)
        File "C:/source/repos/distroless/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 405, column 97, in _get_latest_subversion
                versions = [path.basename for path in repository_ctx.path(vc_path + "\\Tools\\MSVC").readdir()]
Error in readdir: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC (No such file or directory)
ERROR: C:/source/repos/distroless/external/subpar/compiler/BUILD:31:10: @subpar//compiler:compiler depends on @local_config_cc//:cc-compiler-x64_windows in repository @local_config_cc which failed to fetch. no such package '@local_config_cc//': C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC (No such file or directory)

The error appears to come from windows_cc_configure.bzl when pulled in, as vc_path + "\\Tools\\MSVC" does not match up with a path for any build tools I have locally, although I have build tools for VS 2017 and VS 2019 installed, and have otherwise used them successfully. I also installed fresh versions of both to confirm. Is there possibly an issue with the build path, or should I have followed a specialized form of Visual Studio download?

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

  1. Clone GCR Distroless repo.
  2. Cd into repo and run bazel build //package_manager:dpkg_parser.par

What operating system are you running Bazel on?

Windows 10.

What's the output of bazel info release?

release 4.1.0

What's the output of git remote get-url origin ; git rev-parse main ; git rev-parse HEAD ?

https://github.com/GoogleContainerTools/distroless.git
9c235996ada3bd8ddb5029319d7ba6305c0569bf
9c235996ada3bd8ddb5029319d7ba6305c0569bf

Have you found anything relevant by searching the web?

This issue seemed similar, but the failure appeared to be with environment variables rather than file path: https://github.com/bazelbuild/bazel/issues/8943

github-actions[bot] commented 1 year ago

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

github-actions[bot] commented 1 month ago

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.