New issue
Advanced search Search tips

Issue 616146 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2016
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 561763



Sign in to add a comment

ninja cdb\cdb.exe fails for gn builds if DEPOT_TOOLS_WIN_TOOLCHAIN=0 is set

Project Member Reported by brucedaw...@chromium.org, May 31 2016

Issue description

The copying of cdb\cdb.exe fails for gn builds if DEPOT_TOOLS_WIN_TOOLCHAIN=0 is set and vcvarsall.bat has not been run.

This bug was introduced in crrev.com/1859013002. It is easy to miss because most Google employees do not have DEPOT_TOOLS_WIN_TOOLCHAIN=0 set. Often when I have that set I have run vcvarsall.bat and therefore WindowsSdkDir is set. But for external developers it would not be uncommon to have DEPOT_TOOLS_WIN_TOOLCHAIN=0 and not have WindowsSdkDir set. The error looks like this:

> ninja -C out\Debug_gn_component cdb\cdb.exe
C:/src/depot_tools/python276_bin/python.exe ../../build/win/copy_cdb_to_output.py cdb x64
Traceback (most recent call last):
  File "../../build/win/copy_cdb_to_output.py", line 84, in <module>
    sys.exit(main())
  File "../../build/win/copy_cdb_to_output.py", line 80, in main
    return _CopyCDBToOutput(sys.argv[1], sys.argv[2])
  File "../../build/win/copy_cdb_to_output.py", line 56, in _CopyCDBToOutput
    win_sdk_dir = os.path.normpath(os.environ['WINDOWSSDKDIR'])
  File "C:\src\depot_tools\python276_bin\lib\os.py", line 423, in __getitem__
    return self.data[key.upper()]
KeyError: 'WINDOWSSDKDIR'

Either the error needs to be silently ignored (not copying cdb.exe) or vcvarsall.bat should be run in order to set WindowsSDKDir so that the copying succeeds. 

The close() afile comment from here should also be addressed at the same time:
https://codereview.chromium.org/1859013002/diff/80001/build/win/copy_cdb_to_output.py

 
This block of code from build\vs_toolchain.py is probably the appropriate pattern to follow:

def GetToolchainDir():
  """Gets location information about the current toolchain (must have been
  previously updated by 'update'). This is used for the GN build."""
  runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs()

  # If WINDOWSSDKDIR is not set, search the default SDK path and set it.
  if not 'WINDOWSSDKDIR' in os.environ:
    default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10'
    if os.path.isdir(default_sdk_path):
      os.environ['WINDOWSSDKDIR'] = default_sdk_path

Comment 2 by kbr@chromium.org, Jun 1 2016

Is there any chance you could help fix this? The bots don't test this configuration and it's also not the way my machine is set up. If you can reproduce, I'd greatly appreciate it if you could help patch it. Ideally, a best effort should be made to find cdb.exe and copy it. I'm not sure whether it should be a fatal error to not pick it up, though. (Chromium's bots will fail tests if cdb.exe isn't copied appropriately.)

Comment 3 by kbr@chromium.org, Jun 1 2016

Blockedon: 561763
Owner: brucedaw...@chromium.org
I'll take it.

Comment 5 by kbr@chromium.org, Jun 1 2016

Thanks Bruce. Appreciate your help.

Project Member

Comment 6 by bugdroid1@chromium.org, Jun 2 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/250abd283b7db0274df689e6b0dad571fd180a4f

commit 250abd283b7db0274df689e6b0dad571fd180a4f
Author: brucedawson <brucedawson@chromium.org>
Date: Thu Jun 02 18:49:20 2016

Handle case where WINDOWSSDKDIR is not set

If DEPOT_TOOLS_WIN_TOOLCHAIN=0 and vcvarsall.bat has not been run then
WINDOWSSDKDIR will probably not be set and copying cdb\cdb.exe will fail
when copy_cdb_to_output.py tries to read WINDOWSSDKDIR from environ.
This change handles that case by using the default SDK location.

BUG= 616146 

Review-Url: https://codereview.chromium.org/2030723002
Cr-Commit-Position: refs/heads/master@{#397483}

[modify] https://crrev.com/250abd283b7db0274df689e6b0dad571fd180a4f/build/win/copy_cdb_to_output.py

Status: Fixed (was: Assigned)

Sign in to add a comment