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 0.27+ does not support VS 2017 anymore? #8892

Closed
blasnier opened this issue Jul 15, 2019 · 1 comment
Closed

Bazel 0.27+ does not support VS 2017 anymore? #8892

blasnier opened this issue Jul 15, 2019 · 1 comment
Assignees
Labels
area-Windows Windows-specific issues and feature requests P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug

Comments

@blasnier
Copy link

blasnier commented Jul 15, 2019

Description of the problem / feature request:

On Windows, when using Visual Studio 2017 with Bazel 0.27+, an error occurs when configuring the cc toolchain. Here is the error for Bazel 0.27.x:

ERROR: C:/users/xxx/_bazel_xxx/tx5zfai7/external/local_config_cc/BUILD:173:1: in cc_toolchain_config rule @local_config_cc//:msvc_x64:
Traceback (most recent call last):
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/local_config_cc/BUILD", line 173
                cc_toolchain_config(name = 'msvc_x64')
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/local_config_cc/windows_cc_toolchain_config.bzl", line 265, in _impl
                feature(name = "msvc_link_env", env_sets =...)])])
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/local_config_cc/windows_cc_toolchain_config.bzl", line 268, in feature
                env_set(actions = (all_link_actions + [A...]), ...)])
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/local_config_cc/windows_cc_toolchain_config.bzl", line 271, in env_set
                env_entry(key = "LIB", value = ctx.attr.msvc...)
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/cc_toolchain_config_lib.bzl", line 57, in env_entry
                _check_is_nonempty_string(value, "value", "env_entry")
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/cc_toolchain_config_lib.bzl", line 29, in _check_is_nonempty_string
                fail("{} parameter of {} must be a no...))
value parameter of env_entry must be a nonempty string.

On Bazel 0.28 the error is:

ERROR: An error occurred during the fetch of repository 'local_config_cc':
   Traceback (most recent call last):
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/cc_configure.bzl", line 114
                configure_windows_toolchain(repository_ctx)
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 521, in configure_windows_toolchain
                setup_vc_env_vars(repository_ctx, vc_path)
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 296, in setup_vc_env_vars
                _check_env_vars(env_map, cmd)
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/windows_cc_configure.bzl", line 303, in _check_env_vars
                auto_configure_fail(("Setting up VC environment vari...)))
        File "C:/users/xxx/_bazel_xxx/tx5zfai7/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, in auto_configure_fail
                fail(("\n%sAuto-Configuration Error:%...)))

Auto-Configuration Error: Setting up VC environment variables failed, INCLUDE is not set by the following command:
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\VCVARSALL.BAT" amd64  -vcvars_ver=14.10.25017

which leads to an internal error.

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

Set BAZEL_VC to target Visual Studio 2017 and attempt to build a simple hello-world in C++.

What operating system are you running Bazel on?

Windows 10

What's the output of bazel info release?

release 0.28

Any other information, logs, or outputs that you want to share?

Setting BAZEL_VC_FULL_VERSION did not change anything.
The exact version of VS I am running is 15.0.0+26228.57. I checked the vcvarsall.bat on my computer and it does not seem to support the vcvars_ver parameter. I will try to find co-workers with a more recent VS 2017 installation to compare.
BAZEL_VC = C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC

Edit: a co-worker uses a more recent version of VS 2017 (15.9.6) which supports the vcvars_ver parameter. It seems this feature was introduced with version 15.3.

@meteorcloudy
Copy link
Member

meteorcloudy commented Jul 16, 2019

@baslas Thanks for reporting this issue!

Looks like we have wrongly assumed -vcvars_ver flag is supported in all VC version since VS 2017.

if _is_vs_2017_or_2019(vc_path):
full_version = _get_vc_full_version(repository_ctx, vc_path)
if full_version:
vcvars_ver = "-vcvars_ver=" + full_version

We'll fix it soon!

@meteorcloudy meteorcloudy self-assigned this Jul 16, 2019
@meteorcloudy meteorcloudy added P2 We'll consider working on this in future. (Assignee optional) area-Windows Windows-specific issues and feature requests type: bug labels Jul 16, 2019
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 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 P2 We'll consider working on this in future. (Assignee optional) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: bug
Projects
None yet
Development

No branches or pull requests

3 participants