termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.22k stars 3.04k forks source link

python-llvmlite [Package]: #10399

Open Haiz14 opened 2 years ago

Haiz14 commented 2 years ago

Package description

llvmlite provides a Python binding to LLVM for use in Numba. Numba previously relied on llvmpy.

The problematic part of installing installing this package is that it requires llvm v 11.x.x and the current version of llvm on termux is 14.

RuntimeError: Building llvmlite requires LLVM 11.x.x, got '14.0.1'. Be sure to set LLVM_CONFIG to the right executable path.

Home page URL

https://llvmlite.readthedocs.io/en/latest/

Source code URL

https://github.com/numba/llvmlite

Packaging policy acknowledgement

Additional information

I tried building llvm 11.0.0 on termux using cmake --build . -j1 -j2 but termux crashed at when the build reached around 60 %. Now, i am trying to build it using cmake --build . -j1 but it's taking too much time.

licy183 commented 2 years ago

Try to check out the commit of LLVM 11 in this repo and cross-compile it on a x86_64 Linux rather than compile it on device. Seems that main repo will not provide multiple versions of LLVM. See #9605.

Haiz14 commented 2 years ago

Found version 11 https://github.com/amuramatsu/termux-packages/commit/49a643666030da3e42825a3f01e0c5d840cb2cd4

xtkoba commented 2 years ago

The same reason as why we won't package lfortran with LLVM backend (#8884) or emojicode (#9723).

A possible workaround (for our packaging policy) would be that a package should bundle a required version of LLVM, just like ldc is doing.

xtkoba commented 2 years ago

Reference to upstream issue: https://github.com/numba/llvmlite/issues/772.

Haiz14 commented 2 years ago

Built v-11 of llvm using cmake --build . -j1, gonna try to make a wheel for llvm lite now after installation, if successful i will post the wheels so anyone can install llvmlite on termux without installing llvm-11

Haiz14 commented 2 years ago

More info

Contrary to what might be expected, 
the llvmlite packages built by the 
Numba maintainers do not use any LLVM shared libraries that may be present on the system, 
and/or in the Conda environment.

 The parts of LLVM required by llvmlite are statically linked at build time. 
As a result, installing llvmlite from a binary package from the Numba channel does not also require the end user to install LLVM.
 (For more details on the reasoning behind this, 
see: Why Static Linking to LLVM?). 
Note however also that llvmlite packages compiled by other parties,
 e.g. conda-forge may split this into and llvmlite and llvm package and link dynamically.
Haiz14 commented 2 years ago

So, if u guys just package the wheel in termux-packages and install the wheels using python like here, https://github.com/termux/termux-packages/issues/10065#issuecomment-1106359781 in the build script

There wouldn't be any need to package llvm with llvm-lite.

xtkoba commented 2 years ago

To package this we need to build libllvm-static-11 internally because it is not available in our official repo and no binary distribution is available upstream either (IIRC). I meant this situation by "should bundle a required version of LLVM".

Ar57m commented 6 months ago

any updates? I was trying to pip install numba, but was getting an error about building llvmlite, is there a way of installing it? it was saying

RuntimeError: Building llvmlite requires LLVM 14, got '18.1.3'. Be sure to set LLVM_CONFIG to the right executable path.
Biswa96 commented 6 months ago

Yeah, llvmlite needs llvm-14 but maintaining two versions of llvm (now 18.1.3) would be a huge task.

TomJo2000 commented 6 months ago

Fwiw, there is a LLVM 14 package in the TUR, it probably makes sense to move the request there. https://github.com/termux-user-repository/tur/tree/master/tur%2Flibllvm-14