Skip to content

Commit 390cc8a

Browse files
committed
fix building the jit stencils on Windows when the
interpreter is built with a different clang version.
1 parent a57209e commit 390cc8a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix building the jit stencils on Windows when the interpreter is built with
2+
a different clang version. Patch by Chris Eibl.

Tools/jit/_llvm.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,26 @@ async def _run(tool: str, args: typing.Iterable[str], echo: bool = False) -> str
4242
async with _CORES:
4343
if echo:
4444
print(shlex.join(command))
45+
46+
if os.name == "nt":
47+
env = os.environ.copy()
48+
try:
49+
# https://github.com/python/cpython/issues/146210
50+
# When the Python iterpreter is built with
51+
# "/p:PlatformToolset=ClangCL" "/p:LLVMInstallDir=...""
52+
# msbuild populates the INCLUDE variable based on this
53+
# clang version, which might be different to the one used
54+
# for building the jit stencils. Mixing those include paths
55+
# can cause mysterious build errors, so we remove the
56+
# variable from the environment when invoking LLVM tools.
57+
del env["INCLUDE"]
58+
except KeyError:
59+
pass
60+
else:
61+
env = None
4562
try:
4663
process = await asyncio.create_subprocess_exec(
47-
*command, stdout=subprocess.PIPE
64+
*command, stdout=subprocess.PIPE, env=env
4865
)
4966
except FileNotFoundError:
5067
return None

0 commit comments

Comments
 (0)