python / cpython

The Python programming language
https://www.python.org
Other
62.51k stars 30.01k forks source link

RuntimeError: Can't find llvm-readobj-18! #119515

Open johannesnoordanus opened 4 months ago

johannesnoordanus commented 4 months ago

Bug report

Bug description:

I build Python-3.13.0b1 with configure ./configure --enable-experimental-jit=yes (I also tried adding --enable-optimizations) on Linux orangepi3b 6.8.10-edge-rockchip64 #1 SMP PREEMPT Fri May 17 10:15:12 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux After a while I get a runtime error:

RuntimeError: Can't find llvm-readobj-18!

I installed llvm-18 (otherwise I got an error much sooner).

The error lead-up is shown below:

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

  + Exception Group Traceback (most recent call last):
  |   File "/home/johannes/projects/Python-3.13.0b1/./Tools/jit/build.py", line 28, in <module>
  |     args.target.build(pathlib.Path.cwd(), comment=comment, force=args.force)
  |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_targets.py", line 214, in build
  |     stencil_groups = asyncio.run(self._build_stencils())
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
  |     return runner.run(main)
  |            ^^^^^^^^^^^^^^^^
  |   File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
  |     return self._loop.run_until_complete(task)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/usr/local/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete
  |     return future.result()
  |            ^^^^^^^^^^^^^^^
  |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_targets.py", line 189, in _build_stencils
  |     async with asyncio.TaskGroup() as group:
  |   File "/usr/local/lib/python3.12/asyncio/taskgroups.py", line 147, in __aexit__
  |     raise me from None
  | ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_targets.py", line 181, in _compile
    |     return await self._parse(o)
    |            ^^^^^^^^^^^^^^^^^^^^
    |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_targets.py", line 80, in _parse
    |     output = await _llvm.run("llvm-readobj", args, echo=self.verbose)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_llvm.py", line 99, in run
    |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
    | RuntimeError: Can't find llvm-readobj-18!
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_targets.py", line 181, in _compile
    |     return await self._parse(o)
    |            ^^^^^^^^^^^^^^^^^^^^
    |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_targets.py", line 80, in _parse
    |     output = await _llvm.run("llvm-readobj", args, echo=self.verbose)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/johannes/projects/Python-3.13.0b1/Tools/jit/_llvm.py", line 99, in run
    |     raise RuntimeError(f"Can't find {tool}-{_LLVM_VERSION}!")
    | RuntimeError: Can't find llvm-readobj-18!
    +------------------------------------

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Eclips4 commented 4 months ago

Hello! It seems that you missing llvm-readobj-18 on your system, which is needed for CPython JIT. Please, read the https://github.com/python/cpython/blob/main/Tools/jit/README.md for more information.

johannesnoordanus commented 4 months ago

Hello! It seems that you missing llvm-readobj-18 on your system, which is needed for CPython JIT. Please, read the https://github.com/python/cpython/blob/main/Tools/jit/README.md for more information.

Thanks, I read that and installed llvm-18 as mentioned in the README.md:

Linux

Install LLVM 18 on Ubuntu/Debian:

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18

It seems that clang-18 did get installed, but all llvm- tools were missing. I had to issue the following command to get the llvm tools installed:

sudo apt install llvm-18

I think a bug within llvm.sh? Or perhaps llvm.sh isn't compatible with Armbian?

Anyway thanks again, my python 13 build is running now.

sobolevn commented 4 months ago

Try following your sudo ./llvm.sh 18 with

sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
sudo update-alternatives --set clang /usr/bin/clang-18
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
sudo update-alternatives --set clang++ /usr/bin/clang++-18