Setting up VC environment variables failed (WINDOWSSDKDIR) - bazel 4.0.0
#13.261 geöffnet am 23. März 2021
Repository-Metriken
- Stars
- (25.384 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 22T 20h) (77 gemergte PRs in 30 T)
Beschreibung
Description of the problem / feature request:
Trying to follow : https://docs.bazel.build/versions/master/tutorial/java.html can't build 'Bazel Tutorial: Build a Java Project' -> bazel build //:ProjectRunner
What operating system are you running Bazel on?
Windows 10 Pro - Version 1909
What's the output of bazel info release?
release 4.0.0
Have you found anything relevant by searching the web?
This seems to be a similar issue but the proposed solution didn't work https://github.com/bazelbuild/bazel/issues/8943
Any other information, logs, or outputs that you want to share?
C:\Users\Username\Desktop\Working\j2cl\samples\bazelExample\examples\java-tutorial>bazel build //:ProjectRunner Starting local Bazel server and connecting to it... INFO: Repository local_config_cc instantiated at: /DEFAULT.WORKSPACE.SUFFIX:342:13: in C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/cc_configure.bzl:184:16: in cc_configure Repository rule cc_autoconf defined at: C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/cc_configure.bzl:145:30: in ERROR: An error occurred during the fetch of repository 'local_config_cc': Traceback (most recent call last): File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/cc_configure.bzl", line 122, column 36, in cc_autoconf_impl configure_windows_toolchain(repository_ctx) File "C:/users/Username/_bazel_Username/smr4z376/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:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 632, column 32, in _get_msvc_vars env = setup_vc_env_vars(repository_ctx, vc_path) File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 387, column 24, in setup_vc_env_vars _check_env_vars(env_map, cmd, expected = envvars) File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 393, column 32, in _check_env_vars auto_configure_fail( File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, column 9, in auto_configure_fail fail("\n%sAuto-Configuration Error:%s %s\n" % (red, no_color, msg)) Error in fail: Auto-Configuration Error: Setting up VC environment variables failed, WINDOWSSDKDIR is not set by the following command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\VCVARSALL.BAT" amd64 -vcvars_ver=14.28.29910 ERROR: Error fetching repository: Traceback (most recent call last): File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/cc_configure.bzl", line 122, column 36, in cc_autoconf_impl configure_windows_toolchain(repository_ctx) File "C:/users/Username/_bazel_Username/smr4z376/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:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 632, column 32, in _get_msvc_vars env = setup_vc_env_vars(repository_ctx, vc_path) File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 387, column 24, in setup_vc_env_vars _check_env_vars(env_map, cmd, expected = envvars) File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 393, column 32, in _check_env_vars auto_configure_fail( File "C:/users/Username/_bazel_Username/smr4z376/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, column 9, in auto_configure_fail fail("\n%sAuto-Configuration Error:%s %s\n" % (red, no_color, msg)) Error in fail: Auto-Configuration Error: Setting up VC environment variables failed, WINDOWSSDKDIR is not set by the following command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\VCVARSALL.BAT" amd64 -vcvars_ver=14.28.29910 ERROR: C:/users/Username/desktop/working/j2cl/samples/bazelexample/examples/java-tutorial/BUILD:3:12: //:ProjectRunner depends on @local_config_cc//:cc-compiler-x64_windows in repository @local_config_cc which failed to fetch. no such package '@local_config_cc//': Auto-Configuration Error: Setting up VC environment variables failed, WINDOWSSDKDIR is not set by the following command: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\VCVARSALL.BAT" amd64 -vcvars_ver=14.28.29910 ERROR: Analysis of target '//:ProjectRunner' failed; build aborted: Analysis failed INFO: Elapsed time: 29.432s INFO: 0 processes. FAILED: Build did NOT complete successfully (11 packages loaded, 18 targets configured)
As the error says, WINDOWSSDKDIR is not being set. However PATH, LIB and INCLUDE are.

Running 'vcvarsall.bat amd64' with 'set VSCMD_DEBUG=3 'vcvarsall.bat amd64' with 'set VSCMD_DEBUG=3'.txt '
Visual Studio Build Tools installed
Already tried uninstalling, restarting, installing Visual Studio Build Tools and Visual Studio. The same with Windows SDK