Skip to content

Allow Clang-19+ for JIT (currently hard requires clang-19) #145800

Closed

Description

@timkofu

Feature or enhancement

Proposal:

Current --enable-experimental-jit hard requires Clang-19 for Python 3.14.3:

026-03-11T10:25:48.1119897Z #14 62.49 
2026-03-11T10:25:48.1121059Z #14 62.49 ==========================================================
2026-03-11T10:25:48.1121976Z #14 62.49 JIT support for x86_64-pc-linux-gnu is still experimental!
2026-03-11T10:25:48.1123021Z #14 62.49          Please report any issues you encounter.          
2026-03-11T10:25:48.1123777Z #14 62.49 ==========================================================
2026-03-11T10:25:48.1124585Z #14 62.49 
2026-03-11T10:25:48.3356185Z #14 62.51 clang-21 -c -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -march=native -O3 -flto -pipe -march=native -O3 -flto -pipe  -fno-semantic-interposition -flto=full -g -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -D_Py_TIER2=1 -D_Py_JIT -fprofile-instr-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Python/optimizer.o Python/optimizer.c
2026-03-11T10:25:48.3361374Z #14 62.51   + Exception Group Traceback (most recent call last):
2026-03-11T10:25:48.3362072Z #14 62.51   |   File "/python-build/./Tools/jit/build.py", line 52, in <module>
2026-03-11T10:25:48.3362583Z #14 62.51   |     target.build(
2026-03-11T10:25:48.3363110Z #14 62.51   |     ~~~~~~~~~~~~^
2026-03-11T10:25:48.3363441Z #14 62.51   |         comment=comment,
2026-03-11T10:25:48.3363783Z #14 62.51   |         ^^^^^^^^^^^^^^^^
2026-03-11T10:25:48.3364114Z #14 62.51   |         force=args.force,
2026-03-11T10:25:48.3364442Z #14 62.51   |         ^^^^^^^^^^^^^^^^^
2026-03-11T10:25:48.3364943Z #14 62.51   |         jit_stencils=args.output_dir / f"jit_stencils-{target.triple}.h",
2026-03-11T10:25:48.3365568Z #14 62.51   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-11T10:25:48.3365982Z #14 62.51   |     )
2026-03-11T10:25:48.3366230Z #14 62.51   |     ^
2026-03-11T10:25:48.3366623Z #14 62.51   |   File "/python-build/Tools/jit/_targets.py", line 224, in build
2026-03-11T10:25:48.3367263Z #14 62.51   |     stencil_groups = ASYNCIO_RUNNER.run(self._build_stencils())
2026-03-11T10:25:48.3367773Z #14 62.51   |   File "/usr/local/lib/python3.14/asyncio/runners.py", line 127, in run
2026-03-11T10:25:48.3368173Z #14 62.51   |     return self._loop.run_until_complete(task)
2026-03-11T10:25:48.3368482Z #14 62.51   |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
2026-03-11T10:25:48.3369264Z #14 62.51   |   File "/usr/local/lib/python3.14/asyncio/base_events.py", line 719, in run_until_complete
2026-03-11T10:25:48.3369718Z #14 62.51   |     return future.result()
2026-03-11T10:25:48.3369963Z #14 62.51   |            ~~~~~~~~~~~~~^^
2026-03-11T10:25:48.3370321Z #14 62.51   |   File "/python-build/Tools/jit/_targets.py", line 180, in _build_stencils
2026-03-11T10:25:48.3370740Z #14 62.51   |     async with asyncio.TaskGroup() as group:
2026-03-11T10:25:48.3371041Z #14 62.51   |                ~~~~~~~~~~~~~~~~~^^
2026-03-11T10:25:48.3371426Z #14 62.51   |   File "/usr/local/lib/python3.14/asyncio/taskgroups.py", line 72, in __aexit__
2026-03-11T10:25:48.3371858Z #14 62.51   |     return await self._aexit(et, exc)
2026-03-11T10:25:48.3372140Z #14 62.51   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-03-11T10:25:48.3372527Z #14 62.51   |   File "/usr/local/lib/python3.14/asyncio/taskgroups.py", line 174, in _aexit
2026-03-11T10:25:48.3373055Z #14 62.51   |     raise BaseExceptionGroup(
2026-03-11T10:25:48.3373323Z #14 62.51   |     ...<2 lines>...
2026-03-11T10:25:48.3373537Z #14 62.51   |     ) from None
2026-03-11T10:25:48.3373872Z #14 62.51   | ExceptionGroup: unhandled errors in a TaskGroup (286 sub-exceptions)
2026-03-11T10:25:48.3374255Z #14 62.51   +-+---------------- 1 ----------------
2026-03-11T10:25:48.3374539Z #14 62.51     | Traceback (most recent call last):
2026-03-11T10:25:48.3374903Z #14 62.51     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3375460Z #14 62.51     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3375858Z #14 62.51     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3376283Z #14 62.51     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3376639Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3376931Z #14 62.52     +---------------- 2 ----------------
2026-03-11T10:25:48.3377210Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3377566Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3377982Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3378363Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3378769Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3379125Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3379397Z #14 62.52     +---------------- 3 ----------------
2026-03-11T10:25:48.3379673Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3380028Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3380426Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3380804Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3381197Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3381538Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3381812Z #14 62.52     +---------------- 4 ----------------
2026-03-11T10:25:48.3382078Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3382435Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3382957Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3383324Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3383715Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3384058Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3384327Z #14 62.52     +---------------- 5 ----------------
2026-03-11T10:25:48.3384599Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3385070Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3385465Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3385831Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3386212Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3386562Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3386839Z #14 62.52     +---------------- 6 ----------------
2026-03-11T10:25:48.3387105Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3387455Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3387851Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3388212Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3388604Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3388948Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3389223Z #14 62.52     +---------------- 7 ----------------
2026-03-11T10:25:48.3389493Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3389835Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3390235Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3390722Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3391113Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3391463Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3391738Z #14 62.52     +---------------- 8 ----------------
2026-03-11T10:25:48.3392002Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3392352Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3392852Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3393227Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3393620Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3393960Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3394231Z #14 62.52     +---------------- 9 ----------------
2026-03-11T10:25:48.3394504Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3394852Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3395251Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3395613Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3396006Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3396354Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3396626Z #14 62.52     +---------------- 10 ----------------
2026-03-11T10:25:48.3396908Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3397262Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3397659Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3398031Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3398428Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3398766Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3399043Z #14 62.52     +---------------- 11 ----------------
2026-03-11T10:25:48.3399315Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3399671Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3400189Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3400553Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3400948Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3401292Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3401562Z #14 62.52     +---------------- 12 ----------------
2026-03-11T10:25:48.3401846Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3402209Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3402613Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3403098Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3403491Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3403838Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3404121Z #14 62.52     +---------------- 13 ----------------
2026-03-11T10:25:48.3404389Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3404745Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3405141Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3405506Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3406009Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3406373Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3406773Z #14 62.52     +---------------- 14 ----------------
2026-03-11T10:25:48.3407041Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3407395Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3407791Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3408160Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3408555Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3408897Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3409173Z #14 62.52     +---------------- 15 ----------------
2026-03-11T10:25:48.3409446Z #14 62.52     | Traceback (most recent call last):
2026-03-11T10:25:48.3409800Z #14 62.52     |   File "/python-build/Tools/jit/_targets.py", line 167, in _compile
2026-03-11T10:25:48.3410196Z #14 62.52     |     await _llvm.run("clang", args, echo=self.verbose)
2026-03-11T10:25:48.3410563Z #14 62.52     |   File "/python-build/Tools/jit/_llvm.py", line 107, in run
2026-03-11T10:25:48.3410951Z #14 62.52     |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
2026-03-11T10:25:48.3411296Z #14 62.52     | RuntimeError: Can't find clang-19!
2026-03-11T10:25:48.3411873Z #14 62.52     +---------------- ... ----------------
2026-03-11T10:25:48.3412272Z #14 62.52     | and 271 more exceptions
2026-03-11T10:25:48.3412663Z #14 62.52     +------------------------------------

I have Clang-21 installed.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Activity

  1. added
    type-feature
    on Mar 11, 2026
  2. added
    build
    on Mar 11, 2026
  3. sergey-miryanov commented on Mar 11, 2026

    @sergey-miryanov
    Contributor
  4. aisk commented on Mar 11, 2026

    @aisk
    Member

    On the main branch, clang-21 is required and can be used.

  5. Fidget-Spinner commented on Mar 11, 2026

    @Fidget-Spinner
    Member

    The relocations produced in some stencils seem to differ between clang versions. Supporting multiple clang versions would increase the burden of the JIT maintainers. I'm -1 on this.

  6. savannahostrowski commented on Mar 11, 2026

    @savannahostrowski
    Member

    We officially support and use LLVM 21 on main. Last fall, we did add support for folks to modify the LLVM used when building stencils (#138498). However, users do this at their own risk and if there are bugs found by using any version other than the officially supported version, I think we should close these as won't fix (this was also the condition under which I agreed to let users customize the version).

    All of this is also documented in https://github.com/python/cpython/blob/main/Tools/jit/README.md.

  7. added
    pending
    on Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildpendingtopic-JITtype-feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions