Skip to content

Update from CLang 19 to CLang 20 #137399

@kailando

Description

@kailando

I'm trying to build CPython with its JIT functionality.

./configure --enable-experimental-jit
make -j$(nproc)
python3.13 ./Tools/jit/build.py x86_64-pc-linux-gnu --output-dir . --pyconfig-dir . --cflags=""
gcc -I./Modules/_io -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_io/bytesio.c -o Modules/_io/bytesio.o
gcc -I./Modules/_io -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_io/bufferedio.c -o Modules/_io/bufferedio.o
gcc -I./Modules/_io -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_io/textio.c -o Modules/_io/textio.o
gcc -I./Modules/_io -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_io/stringio.c -o Modules/_io/stringio.o
gcc  -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/itertoolsmodule.c -o Modules/itertoolsmodule.o
gcc  -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_sre/sre.c -o Modules/_sre/sre.o
gcc  -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_sysconfig.c -o Modules/_sysconfig.o

==========================================================
JIT support for x86_64-pc-linux-gnu is still experimental!
         Please report any issues you encounter.          
==========================================================

  + Exception Group Traceback (most recent call last):
  |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/./Tools/jit/build.py", line 52, in <module>
  |     target.build(
  |     ~~~~~~~~~~~~^
  |         comment=comment,
  |         ^^^^^^^^^^^^^^^^
  |         force=args.force,
  |         ^^^^^^^^^^^^^^^^^
  |         jit_stencils=args.output_dir / f"jit_stencils-{target.triple}.h",
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |     )
  |     ^
  |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/Tools/jit/_targets.py", line 233, in build
  |     stencil_groups = ASYNCIO_RUNNER.run(self._build_stencils())
  |   File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
  |     return self._loop.run_until_complete(task)
  |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  |   File "/usr/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
  |     return future.result()
  |            ~~~~~~~~~~~~~^^
  |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/Tools/jit/_targets.py", line 193, in _build_stencils
  |     async with asyncio.TaskGroup() as group:
  |                ~~~~~~~~~~~~~~~~~^^
  |   File "/usr/lib/python3.13/asyncio/taskgroups.py", line 71, in __aexit__
  |     return await self._aexit(et, exc)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/usr/lib/python3.13/asyncio/taskgroups.py", line 173, in _aexit
  |     raise BaseExceptionGroup(
  |     ...<2 lines>...
  |     ) from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/Tools/jit/_targets.py", line 175, in _compile
    |     await _llvm.run("clang", args_s, echo=self.verbose)
    |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/Tools/jit/_llvm.py", line 107, in run
    |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
    | RuntimeError: Can't find clang-19!
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/Tools/jit/_targets.py", line 175, in _compile
    |     await _llvm.run("clang", args_s, echo=self.verbose)
    |   File "/home/kaig/Documents/Projects/Standoffs/JIT-Python/Tools/jit/_llvm.py", line 107, in run
    |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
    | RuntimeError: Can't find clang-19!
    +------------------------------------
gcc  -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -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  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE_BUILTIN -c ./Modules/_threadmodule.c -o Modules/_threadmodule.o
make: *** [Makefile:3280: jit_stencils.h] Error 1
make: *** Waiting for unfinished jobs....

I tried to symlink CLang 19 and CLang 19++ to their 20 counterparts and updated the ENV variables, but it still failed.
As most of us have CLang 20 and that CLang 20 is backwards-compatible with CLang 19, I feel that the files should be updated to CLang 20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions