Skip to content

Commit

Permalink
fix 'error: Microsoft Visual C++ 14.0 is required' red herring on Git…
Browse files Browse the repository at this point in the history
…Hub Actions (#998)

Summary:
Pull Request resolved: facebook/watchman#998

A detailed description of this change is included in the new comment.

Reviewed By: fanzeyi

Differential Revision: D34124030

fbshipit-source-id: f37c458bae135357e16b256e09f0d6eb8f1f996d
  • Loading branch information
chadaustin authored and facebook-github-bot committed Feb 10, 2022
1 parent 546f362 commit fc90d3e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions build/fbcode_builder/getdeps/buildopts.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,31 @@ def compute_env_for_install_dirs(self, install_dirs, env=None, manifest=None):
env["GETDEPS_BUILD_DIR"] = os.path.join(self.scratch_dir, "build")
env["GETDEPS_INSTALL_DIR"] = self.install_dir

# Python setuptools attempts to discover a local MSVC for
# building Python extensions. On Windows, getdeps already
# supports invoking a vcvarsall prior to compilation.
#
# Tell setuptools to bypass its own search. This fixes a bug
# where setuptools would fail when run from CMake on GitHub
# Actions with the inscrutable message 'error: Microsoft
# Visual C++ 14.0 is required. Get it with "Build Tools for
# Visual Studio"'. I suspect the actual error is that the
# environment or PATH is overflowing.
#
# For extra credit, someone could patch setuptools to
# propagate the actual error message from vcvarsall, because
# often it does not mean Visual C++ is not available.
#
# Related discussions:
# - https://github.com/pypa/setuptools/issues/2028
# - https://github.com/pypa/setuptools/issues/2307
# - https://developercommunity.visualstudio.com/t/error-microsoft-visual-c-140-is-required/409173
# - https://github.com/OpenMS/OpenMS/pull/4779
# - https://github.com/actions/virtual-environments/issues/1484

if self.is_windows() and self.get_vcvars_path():
env["DISTUTILS_USE_SDK"] = "1"

# On macOS we need to set `SDKROOT` when we use clang for system
# header files.
if self.is_darwin() and "SDKROOT" not in env:
Expand Down

0 comments on commit fc90d3e

Please sign in to comment.