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

Fails to build on Win 11 with Preview visual studio #268

Open
kfsone opened this issue Jun 6, 2024 · 0 comments · May be fixed by #269
Open

Fails to build on Win 11 with Preview visual studio #268

kfsone opened this issue Jun 6, 2024 · 0 comments · May be fixed by #269

Comments

@kfsone
Copy link

kfsone commented Jun 6, 2024

Command line:

py.exe build-windows.py --profile noopt --vs 2022 --python cpython-3.12 --sh c:\cygwin64\bin\bash.exe

downloads strawberry perl, process libffi, and then fails with the obtuse: VC\Auxiliary\Build\vcvarsall.bat not found.

This appears to be two fold:

1- the result of the subcommand in find_vs_path is not checked for emptiness,
2- the command is not passing the "-prerelease" option to vswhere,

An easy fix would be:

diff --git a/cpython-windows/build.py b/cpython-windows/build.py
index bc97cd5..66ff6a1 100644
--- a/cpython-windows/build.py
+++ b/cpython-windows/build.py
@@ -233,18 +233,22 @@ def find_vs_path(path, msvc_version):
     else:
         raise ValueError(f"unsupported Visual Studio version: {msvc_version}")

-    p = subprocess.check_output(
-        [
-            str(vswhere),
-            # Visual Studio 2019.
-            "-version",
-            version,
-            "-property",
-            "installationPath",
-            "-products",
-            "*",
-        ]
-    )
+    cmdline = [
+        str(vswhere),
+        # Visual Studio 2019.
+        "-version",
+        version,
+        "-property",
+        "installationPath",
+        "-prerelease",
+        "-products",
+        "*",
+    ]
+    p = subprocess.check_output(cmdline)
+    if not p:
+        cmd = ' '.join('"%s"' % i for i in cmdline)
+        print("could not find visual studio (using '%s')" % cmd)
+        sys.exit(1)

But I suspect this would kick the can down the road to an additional problem if you had vs2022 and vs2022 preview installed.

kfsone added a commit to kfsone/python-build-standalone that referenced this issue Jun 6, 2024
fixes indygreg#268

- add the '-prerelease' flag to the vswhere subcommand,
- give 'no vs found' error if the command returns empty string,
- catch vswhere returning multiple installations,
@kfsone kfsone linked a pull request Jun 6, 2024 that will close this issue
kfsone added a commit to kfsone/python-build-standalone that referenced this issue Jun 10, 2024
fixes indygreg#268

- add the '-prerelease' flag to the vswhere subcommand,
- give 'no vs found' error if the command returns empty string,
- catch vswhere returning multiple installations,
- in-case of failure, report vswhere command line, placing
  any arguments that contain spaces in quotes
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

Successfully merging a pull request may close this issue.

1 participant