Change in bazel[master]: Detect Visual C++ build tools through vcvarsqueryregistry.bat

230 views
Skip to first unread message

Yun Peng (Gerrit)

unread,
Feb 7, 2017, 10:30:53 AM2/7/17
to bazel-de...@googlegroups.com

Yun Peng has uploaded this change for review.

View Change

Detect Visual C++ build tools through vcvarsqueryregistry.bat

Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
---
M tools/cpp/cc_configure.bzl
1 file changed, 49 insertions(+), 20 deletions(-)

diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
index f7eb191..f12ab84 100644
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -424,13 +424,45 @@
   auto_configure_warning("Python found at %s" % python_binary)
   return python_binary
 
+def _add_system_root(repository_ctx, env):
+  """Running VCVARSALL.BAT and VCVARSQUERYREGISTRY.BAT need %SYSTEMROOT%\\system32 to be in PATH."""
+  if "PATH" not in env:
+    env["PATH"] = ""
+  env["PATH"] = env["PATH"] + ";" + _get_system_root(repository_ctx) + "\\system32"
+  return env
 
-def _find_vs_path(repository_ctx):
-  """Find Visual Studio install path."""
+def _find_vc_path(repository_ctx):
+  """Find Visual C++ build tools install path."""
+  # 1. Check if BAZEL_VC or BAZEL_VS is already set by user.
+  if "BAZEL_VC" in repository_ctx.os.environ:
+    return repository_ctx.os.environ["BAZEL_VC"]
+
   if "BAZEL_VS" in repository_ctx.os.environ:
-    return repository_ctx.os.environ["BAZEL_VS"]
-  auto_configure_warning("'BAZEL_VS' is not set, start looking for the latest Visual Studio installed.")
+    return repository_ctx.os.environ["BAZEL_VS"] + "\\VC\\"
+  auto_configure_warning("'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.")
 
+  # 2. Check if VS%VS_VERSION%COMNTOOLS is set, if true then try to find and use vcvarsqueryregistry.bat to detect VC++.
+  auto_configure_warning("Looking for VS%VERSION%COMNTOOLS environment variables, eg. VS140COMNTOOLS")
+  for vscommontools_env in ["VS140COMNTOOLS", "VS120COMNTOOLS", "VS110COMNTOOLS", "VS100COMNTOOLS", "VS90COMNTOOLS"]:
+    if not vscommontools_env in repository_ctx.os.environ:
+      continue
+    vcvarsqueryregistry = repository_ctx.os.environ[vscommontools_env] + "\\" + "vcvarsqueryregistry.bat"
+    if not repository_ctx.path(vcvarsqueryregistry).exists:
+      continue
+    repository_ctx.file("wrapper/get_vc_dir.bat",
+                        "@echo off\n" +
+                        "call \"" + vcvarsqueryregistry + "\"\n" +
+                        "echo %VCINSTALLDIR%", True)
+    env = _add_system_root(repository_ctx, repository_ctx.os.environ)
+    vc_dir = _execute(repository_ctx, ["wrapper/get_vc_dir.bat"], environment=env)
+
+    auto_configure_warning("Visual C++ build tools found at %s" % vc_dir)
+    return vc_dir
+
+  # 3. User might clean up all environment variables, if so looking for Visual C++ through registry.
+  # This method only works if Visual Studio is installed, and for some reason, is flaky.
+  # https://github.com/bazelbuild/bazel/issues/2434
+  auto_configure_warning("Looking for Visual C++ through registry")
   # Query the installed visual stduios on the machine, should return something like:
   # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0
   # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0
@@ -460,23 +492,20 @@
             vs_dir = "\\".join(path_segments[:-2])
 
   if not vs_dir:
-    auto_configure_fail("Visual Studio not found on your machine.")
-  auto_configure_warning("Visual Studio found at %s" % vs_dir)
-  return vs_dir
+    auto_configure_fail("Visual C++ build tools not found on your machine.")
+  vc_dir = vs_dir + "\\VC\\"
+  auto_configure_warning("Visual C++ build tools found at %s" % vc_dir)
+  return vc_dir
 
 
-def _find_env_vars(repository_ctx, vs_path):
+def _find_env_vars(repository_ctx, vc_path):
   """Get environment variables set by VCVARSALL.BAT."""
-  vsvars = vs_path + "/VC/VCVARSALL.BAT"
+  vsvars = vc_path + "/VCVARSALL.BAT"
   repository_ctx.file("wrapper/get_env.bat",
                       "@echo off\n" +
                       "call \"" + vsvars + "\" amd64 \n" +
                       "echo PATH=%PATH%,INCLUDE=%INCLUDE%,LIB=%LIB% \n", True)
-  env = repository_ctx.os.environ
-  if "PATH" not in env:
-    env["PATH"]=""
-  # Running VCVARSALL.BAT needs %SYSTEMROOT%\\system32 to be in PATH
-  env["PATH"] = env["PATH"] + ";" + _get_system_root(repository_ctx) + "\\system32"
+  env = _add_system_root(repository_ctx, repository_ctx.os.environ)
   envs = _execute(repository_ctx, ["wrapper/get_env.bat"], environment=env).split(",")
   env_map = {}
   for env in envs:
@@ -485,12 +514,12 @@
   return env_map
 
 
-def _is_support_whole_archive(repository_ctx, vs_dir):
+def _is_support_whole_archive(repository_ctx, vc_dir):
   """Run MSVC linker alone to see if it supports /WHOLEARCHIVE."""
   env = repository_ctx.os.environ
   if "NO_WHOLE_ARCHIVE_OPTION" in env and env["NO_WHOLE_ARCHIVE_OPTION"] == "1":
     return False
-  result = _execute(repository_ctx, [vs_dir + "/VC/BIN/amd64/link"])
+  result = _execute(repository_ctx, [vc_dir + "/BIN/amd64/link"])
   return result.find("/WHOLEARCHIVE") != -1
 
 
@@ -554,13 +583,13 @@
     python_binary = _find_python(repository_ctx)
     _tpl(repository_ctx, "wrapper/bin/call_python.bat", {"%{python_binary}": python_binary})
 
-    vs_path = _find_vs_path(repository_ctx)
-    env = _find_env_vars(repository_ctx, vs_path)
+    vc_path = _find_vc_path(repository_ctx)
+    env = _find_env_vars(repository_ctx, vc_path)
     python_dir = python_binary[0:-10].replace("\\", "\\\\")
     include_paths = env["INCLUDE"] + (python_dir + "include")
     lib_paths = env["LIB"] + (python_dir + "libs")
-    lib_tool = vs_path.replace("\\", "\\\\") + "/VC/bin/amd64/lib.exe"
-    if _is_support_whole_archive(repository_ctx, vs_path):
+    lib_tool = vc_path.replace("\\", "\\\\") + "/bin/amd64/lib.exe"
+    if _is_support_whole_archive(repository_ctx, vc_path):
       support_whole_archive = "True"
     else:
       support_whole_archive = "False"

To view, visit change 8693. To unsubscribe, visit settings.

Gerrit-Project: bazel
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
Gerrit-Change-Number: 8693
Gerrit-PatchSet: 1
Gerrit-Owner: Yun Peng <pcl...@google.com>

Yun Peng (Gerrit)

unread,
Feb 7, 2017, 10:31:52 AM2/7/17
to bazel-de...@googlegroups.com

Yun Peng uploaded patch set #2 to this change.

View Change

Detect Visual C++ build tools through vcvarsqueryregistry.bat

See: https://github.com/bazelbuild/bazel/issues/2434
Fixed https://github.com/bazelbuild/bazel/issues/2448

Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
---
M tools/cpp/cc_configure.bzl
1 file changed, 49 insertions(+), 20 deletions(-)

To view, visit change 8693. To unsubscribe, visit settings.

Gerrit-Project: bazel
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
Gerrit-Change-Number: 8693
Gerrit-PatchSet: 2
Gerrit-Owner: Yun Peng <pcl...@google.com>

Dmitry Lomov (Gerrit)

unread,
Feb 7, 2017, 10:36:36 AM2/7/17
to Yun Peng, László Csomor

Dmitry Lomov posted comments on this change.

View Change

Patch set 2:Verified +1Code-Review +2

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 2
    Gerrit-Owner: Yun Peng <pcl...@google.com>
    Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
    Gerrit-Reviewer: László Csomor <laszlo...@google.com>
    Gerrit-Comment-Date: Tue, 07 Feb 2017 15:36:33 +0000
    Gerrit-HasComments: No

    László Csomor (Gerrit)

    unread,
    Feb 7, 2017, 11:36:01 AM2/7/17
    to Yun Peng, Bazel CI, Dmitry Lomov

    László Csomor posted comments on this change.

    View Change

    Patch set 2:

    (2 comments)

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 2
    Gerrit-Owner: Yun Peng <pcl...@google.com>
    Gerrit-Reviewer: Bazel CI <ci.b...@gmail.com>
    Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
    Gerrit-Reviewer: László Csomor <laszlo...@google.com>
    Gerrit-Comment-Date: Tue, 07 Feb 2017 16:35:58 +0000
    Gerrit-HasComments: Yes

    Yun Peng (Gerrit)

    unread,
    Feb 7, 2017, 12:44:41 PM2/7/17
    to László Csomor, Dmitry Lomov, Bazel CI

    Yun Peng uploaded patch set #3 to this change.

    View Change

    Detect Visual C++ build tools through vcvarsqueryregistry.bat
    
    See: https://github.com/bazelbuild/bazel/issues/2434
    Fixed https://github.com/bazelbuild/bazel/issues/2448
    
    Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    ---
    M tools/cpp/cc_configure.bzl
    1 file changed, 49 insertions(+), 20 deletions(-)
    
    

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: newpatchset
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 3

    Yun Peng (Gerrit)

    unread,
    Feb 7, 2017, 1:03:45 PM2/7/17
    to László Csomor, Dmitry Lomov, Bazel CI

    Yun Peng uploaded patch set #4 to this change.

    View Change

    Detect Visual C++ build tools through vcvarsqueryregistry.bat
    
    See: https://github.com/bazelbuild/bazel/issues/2434
    Fixed https://github.com/bazelbuild/bazel/issues/2448
    
    Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    ---
    M tools/cpp/cc_configure.bzl
    1 file changed, 53 insertions(+), 20 deletions(-)
    
    

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: newpatchset
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 4

    Yun Peng (Gerrit)

    unread,
    Feb 7, 2017, 1:03:50 PM2/7/17
    to László Csomor, Bazel CI, Dmitry Lomov

    Yun Peng posted comments on this change.

    View Change

    Patch set 2:

    (2 comments)

      • Looks like the limit is 100 chars, updated.

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 2
    Gerrit-Owner: Yun Peng <pcl...@google.com>
    Gerrit-Reviewer: Bazel CI <ci.b...@gmail.com>
    Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
    Gerrit-Reviewer: László Csomor <laszlo...@google.com>
    Gerrit-Reviewer: Yun Peng <pcl...@google.com>
    Gerrit-Comment-Date: Tue, 07 Feb 2017 18:03:48 +0000
    Gerrit-HasComments: Yes

    László Csomor (Gerrit)

    unread,
    Feb 8, 2017, 3:53:03 AM2/8/17
    to Yun Peng, Bazel CI, Dmitry Lomov

    László Csomor posted comments on this change.

    View Change

    Patch set 4:Verified +1Code-Review +2

    Just nits, thanks for your efforts on this change! Looks good.

    (2 comments)

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yun Peng <pcl...@google.com>
    Gerrit-Reviewer: Bazel CI <ci.b...@gmail.com>
    Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
    Gerrit-Reviewer: László Csomor <laszlo...@google.com>
    Gerrit-Reviewer: Yun Peng <pcl...@google.com>
    Gerrit-Comment-Date: Wed, 08 Feb 2017 08:53:00 +0000
    Gerrit-HasComments: Yes

    Yun Peng (Gerrit)

    unread,
    Feb 8, 2017, 4:04:47 AM2/8/17
    to László Csomor, Bazel CI, Dmitry Lomov

    Yun Peng posted comments on this change.

    View Change

    Patch set 4:

    (2 comments)

      • The internal lint checker suggest to add r because the comment contains backslash.

      • Hmm.. VC++ build tools can be a part of VS, but users can actually install VS without the build tools. I think using the term "build tools" sort of remind them to install it.

    To view, visit change 8693. To unsubscribe, visit settings.

    Gerrit-Project: bazel
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
    Gerrit-Change-Number: 8693
    Gerrit-PatchSet: 4
    Gerrit-Owner: Yun Peng <pcl...@google.com>
    Gerrit-Reviewer: Bazel CI <ci.b...@gmail.com>
    Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
    Gerrit-Reviewer: László Csomor <laszlo...@google.com>
    Gerrit-Reviewer: Yun Peng <pcl...@google.com>
    Gerrit-Comment-Date: Wed, 08 Feb 2017 09:04:44 +0000
    Gerrit-HasComments: Yes

    László Csomor (Gerrit)

    unread,
    Feb 8, 2017, 4:13:27 AM2/8/17
    to Yun Peng, Bazel CI, Dmitry Lomov

    László Csomor posted comments on this change.

    View Change

    Patch set 4:

    Patch Set 4:

    (2 comments)

    Cool, thanks!

      To view, visit change 8693. To unsubscribe, visit settings.

      Gerrit-Project: bazel
      Gerrit-Branch: master
      Gerrit-MessageType: comment
      Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
      Gerrit-Change-Number: 8693
      Gerrit-PatchSet: 4
      Gerrit-Owner: Yun Peng <pcl...@google.com>
      Gerrit-Reviewer: Bazel CI <ci.b...@gmail.com>
      Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
      Gerrit-Reviewer: László Csomor <laszlo...@google.com>
      Gerrit-Reviewer: Yun Peng <pcl...@google.com>
      Gerrit-Comment-Date: Wed, 08 Feb 2017 09:13:24 +0000
      Gerrit-HasComments: No

      Kristina Chodorow (Gerrit)

      unread,
      Feb 8, 2017, 10:52:35 AM2/8/17
      to Yun Peng, László Csomor, Bazel CI, Dmitry Lomov

      Kristina Chodorow merged this change.

      View Change

      Approvals: László Csomor: Looks good to me, approved; Verified Dmitry Lomov: Looks good to me, approved; Verified Objections: Bazel CI: Fails
      Detect Visual C++ build tools through vcvarsqueryregistry.bat 
      
      See: https://github.com/bazelbuild/bazel/issues/2434
      Fixed https://github.com/bazelbuild/bazel/issues/2448
      
      --
      Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
      Reviewed-on: https://cr.bazel.build/8693
      PiperOrigin-RevId: 146886981
      MOS_MIGRATED_REVID=146886981
      ---
      M tools/cpp/cc_configure.bzl
      1 file changed, 53 insertions(+), 20 deletions(-)
      
      
      diff --git a/tools/cpp/cc_configure.bzl b/tools/cpp/cc_configure.bzl
      index f7eb191..7ee9356 100644
      --- a/tools/cpp/cc_configure.bzl
      +++ b/tools/cpp/cc_configure.bzl
      @@ -424,13 +424,49 @@
         auto_configure_warning("Python found at %s" % python_binary)
         return python_binary
       
      +def _add_system_root(repository_ctx, env):
      +  r"""Running VCVARSALL.BAT and VCVARSQUERYREGISTRY.BAT need %SYSTEMROOT%\\system32 in PATH."""
      +  if "PATH" not in env:
      +    env["PATH"] = ""
      +  env["PATH"] = env["PATH"] + ";" + _get_system_root(repository_ctx) + "\\system32"
      +  return env
       
      -def _find_vs_path(repository_ctx):
      -  """Find Visual Studio install path."""
      +def _find_vc_path(repository_ctx):
      +  """Find Visual C++ build tools install path."""
      +  # 1. Check if BAZEL_VC or BAZEL_VS is already set by user.
      +  if "BAZEL_VC" in repository_ctx.os.environ:
      +    return repository_ctx.os.environ["BAZEL_VC"]
      +
         if "BAZEL_VS" in repository_ctx.os.environ:
      -    return repository_ctx.os.environ["BAZEL_VS"]
      -  auto_configure_warning("'BAZEL_VS' is not set, start looking for the latest Visual Studio installed.")
      +    return repository_ctx.os.environ["BAZEL_VS"] + "\\VC\\"
      +  auto_configure_warning("'BAZEL_VC' is not set, " +
      +                         "start looking for the latest Visual C++ installed.")
       
      +  # 2. Check if VS%VS_VERSION%COMNTOOLS is set, if true then try to find and use
      +  # vcvarsqueryregistry.bat to detect VC++.
      +  auto_configure_warning("Looking for VS%VERSION%COMNTOOLS environment variables," +
      +                         "eg. VS140COMNTOOLS")
      +  for vscommontools_env in ["VS140COMNTOOLS", "VS120COMNTOOLS",
      +                            "VS110COMNTOOLS", "VS100COMNTOOLS", "VS90COMNTOOLS"]:
      +    if vscommontools_env not in repository_ctx.os.environ:
      +      continue
      +    vcvarsqueryregistry = repository_ctx.os.environ[vscommontools_env] + "\\vcvarsqueryregistry.bat"
      +    if not repository_ctx.path(vcvarsqueryregistry).exists:
      +      continue
      +    repository_ctx.file("wrapper/get_vc_dir.bat",
      +                        "@echo off\n" +
      +                        "call \"" + vcvarsqueryregistry + "\"\n" +
      +                        "echo %VCINSTALLDIR%", True)
      +    env = _add_system_root(repository_ctx, repository_ctx.os.environ)
      +    vc_dir = _execute(repository_ctx, ["wrapper/get_vc_dir.bat"], environment=env)
      +
      +    auto_configure_warning("Visual C++ build tools found at %s" % vc_dir)
      +    return vc_dir
      +
      +  # 3. User might clean up all environment variables, if so looking for Visual C++ through registry.
      +  # This method only works if Visual Studio is installed, and for some reason, is flaky.
      +  # https://github.com/bazelbuild/bazel/issues/2434
      +  auto_configure_warning("Looking for Visual C++ through registry")
         # Query the installed visual stduios on the machine, should return something like:
         # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0
         # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0
      @@ -460,23 +496,20 @@
                   vs_dir = "\\".join(path_segments[:-2])
       
         if not vs_dir:
      -    auto_configure_fail("Visual Studio not found on your machine.")
      -  auto_configure_warning("Visual Studio found at %s" % vs_dir)
      -  return vs_dir
      +    auto_configure_fail("Visual C++ build tools not found on your machine.")
      +  vc_dir = vs_dir + "\\VC\\"
      +  auto_configure_warning("Visual C++ build tools found at %s" % vc_dir)
      +  return vc_dir
       
       
      -def _find_env_vars(repository_ctx, vs_path):
      +def _find_env_vars(repository_ctx, vc_path):
         """Get environment variables set by VCVARSALL.BAT."""
      -  vsvars = vs_path + "/VC/VCVARSALL.BAT"
      +  vsvars = vc_path + "/VCVARSALL.BAT"
         repository_ctx.file("wrapper/get_env.bat",
                             "@echo off\n" +
                             "call \"" + vsvars + "\" amd64 \n" +
                             "echo PATH=%PATH%,INCLUDE=%INCLUDE%,LIB=%LIB% \n", True)
      -  env = repository_ctx.os.environ
      -  if "PATH" not in env:
      -    env["PATH"]=""
      -  # Running VCVARSALL.BAT needs %SYSTEMROOT%\\system32 to be in PATH
      -  env["PATH"] = env["PATH"] + ";" + _get_system_root(repository_ctx) + "\\system32"
      +  env = _add_system_root(repository_ctx, repository_ctx.os.environ)
         envs = _execute(repository_ctx, ["wrapper/get_env.bat"], environment=env).split(",")
         env_map = {}
         for env in envs:
      @@ -485,12 +518,12 @@
         return env_map
       
       
      -def _is_support_whole_archive(repository_ctx, vs_dir):
      +def _is_support_whole_archive(repository_ctx, vc_dir):
         """Run MSVC linker alone to see if it supports /WHOLEARCHIVE."""
         env = repository_ctx.os.environ
         if "NO_WHOLE_ARCHIVE_OPTION" in env and env["NO_WHOLE_ARCHIVE_OPTION"] == "1":
           return False
      -  result = _execute(repository_ctx, [vs_dir + "/VC/BIN/amd64/link"])
      +  result = _execute(repository_ctx, [vc_dir + "/BIN/amd64/link"])
         return result.find("/WHOLEARCHIVE") != -1
       
       
      @@ -554,13 +587,13 @@
           python_binary = _find_python(repository_ctx)
           _tpl(repository_ctx, "wrapper/bin/call_python.bat", {"%{python_binary}": python_binary})
       
      -    vs_path = _find_vs_path(repository_ctx)
      -    env = _find_env_vars(repository_ctx, vs_path)
      +    vc_path = _find_vc_path(repository_ctx)
      +    env = _find_env_vars(repository_ctx, vc_path)
           python_dir = python_binary[0:-10].replace("\\", "\\\\")
           include_paths = env["INCLUDE"] + (python_dir + "include")
           lib_paths = env["LIB"] + (python_dir + "libs")
      -    lib_tool = vs_path.replace("\\", "\\\\") + "/VC/bin/amd64/lib.exe"
      -    if _is_support_whole_archive(repository_ctx, vs_path):
      +    lib_tool = vc_path.replace("\\", "\\\\") + "/bin/amd64/lib.exe"
      +    if _is_support_whole_archive(repository_ctx, vc_path):
             support_whole_archive = "True"
           else:
             support_whole_archive = "False"
      

      To view, visit change 8693. To unsubscribe, visit settings.

      Gerrit-Project: bazel
      Gerrit-Branch: master
      Gerrit-MessageType: merged
      Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
      Gerrit-Change-Number: 8693
      Gerrit-PatchSet: 5
      Gerrit-Owner: Yun Peng <pcl...@google.com>
      Gerrit-Reviewer: Bazel CI <ci.b...@gmail.com>
      Gerrit-Reviewer: Dmitry Lomov <dsl...@google.com>
      Gerrit-Reviewer: Kristina Chodorow <kcho...@google.com>

      Kristina Chodorow (Gerrit)

      unread,
      Feb 8, 2017, 10:52:35 AM2/8/17
      to Yun Peng, László Csomor, Dmitry Lomov, Bazel CI

      Kristina Chodorow uploaded patch set #5 to this change.

      View Change

      Detect Visual C++ build tools through vcvarsqueryregistry.bat 
      
      See: https://github.com/bazelbuild/bazel/issues/2434
      Fixed https://github.com/bazelbuild/bazel/issues/2448
      
      --
      Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
      Reviewed-on: https://cr.bazel.build/8693
      PiperOrigin-RevId
      : 146886981
      MOS_MIGRATED_REVID=146886981
      ---
      M tools/cpp/cc_configure.bzl
      1 file changed, 53 insertions(+), 20 deletions(-)
      
      

      To view, visit change 8693. To unsubscribe, visit settings.

      Gerrit-Project: bazel
      Gerrit-Branch: master
      Gerrit-MessageType: newpatchset
      Gerrit-Change-Id: I12b109af81e0eb8948fd1d7a7d2bbfcf6baa7ca4
      Gerrit-Change-Number: 8693
      Reply all
      Reply to author
      Forward
      0 new messages