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

Improve error reporting when build tools do not include C++ #55

Closed
out0xb2 opened this issue Nov 23, 2019 · 2 comments
Closed

Improve error reporting when build tools do not include C++ #55

out0xb2 opened this issue Nov 23, 2019 · 2 comments

Comments

@out0xb2
Copy link
Contributor

out0xb2 commented Nov 23, 2019

For scenarios where both BuildTools and Visual Studio have been installed, library cannot always find vcvarsall.bat

venv_pytools_dev\lib\site-packages\edk2toollib\bin\vswhere.exe -latest -nologo -all -property installationPath -products *
returns
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools

But vcvarsall.bat is not under the BuildTools path, it is found:

dir /s "c:\Program Files (x86)"\vcvarsall.bat
 Volume in drive C is Local Disk
 Volume Serial Number is F000-B000

 Directory of c:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build

09/27/19  01:14 PM             9,889 vcvarsall.bat
               1 File(s)          9,889 bytes

 Directory of c:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build

10/24/19  05:24 PM             9,859 vcvarsall.bat
               1 File(s)          9,859 bytes

 Directory of c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

02/19/18  08:41 PM             3,600 vcvarsall.bat
               1 File(s)          3,600 bytes

How did I get here?

  1. Install VS2017 & VS2019 Build Tools
  2. Later install both Visual Studio 2017 Enterprise and 2019 Enterprise
  3. Attempt to install VS2015 Build Tools, but it does not really install
  4. Modify VS2017 Build Tools to include the VC2015 toolset

The actual, ugly error message is:

DEBUG - Calling 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat x86'
CRITICAL - Build Process Exception
ERROR - Traceback (most recent call last):
File "c:\git\edk2-pytool-extensions\edk2toolext\environment\uefi_build.py", line 127, in Go
ret = self.PreBuild()
File "c:\git\edk2-pytool-extensions\edk2toolext\environment\uefi_build.py", line 296, in PreBuild
rc = Descriptor.Obj.do_pre_build(self)
File "C:\git\edk2_py_platforms\Silicon\Intel\Tools\IntelSiliconTools.py", line 37, in do_pre_build
vs_vars = locate_tools.QueryVcVariables(interesting_keys, "x86")
File "c:\git\venv_pytools_dev\lib\site-packages\edk2toollib\windows\locate_tools.py", line 175, in QueryVcVariables
popen = subprocess.Popen('"%s" %s & set' % (vcvarsall_path, arch), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "C:\Program Files\Python37\lib\subprocess.py", line 775, in __init__ restore_signals, start_new_session)
File "C:\Program Files\Python37\lib\subprocess.py", line 1178, in _execute_child                                                                                                                                                                                                           startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
@out0xb2
Copy link
Contributor Author

out0xb2 commented Nov 23, 2019

@spbrogan declares this "user error", but I maintain that we should catch this exception and provide more actionable error message.

It appears that this is because PyLibrary only looks at the newest installation, and if that newest installation does not have the C++ build tools, it results in this failure.

@out0xb2 out0xb2 changed the title QueryVcVariables() cannot find vcvarsall.bat when BuildTools installed after Studio Improve error reporting when build tools do not include C++ Nov 25, 2019
@Javagedes
Copy link
Contributor

This was unknowingly resolved in #221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants