Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Originally a github fork of the llvm-py repository from updated to work with LLVM 3.x. Since then it has changed significantly with multiple sub-projects.
HTML Python C++ LLVM CSS C Other
Failed to load latest commit information.
buildscripts/condarecipe Improve setup script:
docs Update docs to require LLVM 3.3, use HTTPS urls to git, and inidcate …
example Simple example to demo llvm ir alloca, load, store instructions
llpython Remove shebangs from library code
llrtc add div64 and mod64
llvm Add ATTR_RETURNS_TWICE (patch by sbourdeauducq)
llvm_array fix spaces redundant trailing spaces and missing line break at EOF
llvm_cbuilder Fix deprecated function use
llvmpy Fix a leak where the "refcount" of a thing was always incremented eve…
test change module name from llvm.test_llvmpy to
tools add NVPTX for LLVM 3.2;
www cleanup
.gitattributes add missing llvm/
.gitignore Finished wrapper in llvm.core
.travis.yml Improve setup script:
CHANGELOG Update changelog
LICENSE Update license and README BUG: the win-32 specific config file was not included in the sdist.
README.rst Update README regarding switching to llvmlite Add Stephen's llvm-cbuilder examples. Add LLVM_TBLGEN_PATH to use alternative LLVM build on win32 Added support to setup to try version specific llvm-configs on linux … add versioneer


llvmpy: Python bindings for LLVM

Important Note: Use llvmlite instead

This project is no longer maintained and users are recommended to switch to llvmlite, which is developed by llvmpy maintainers and numba developers. For temporary compatibility with llvmpy, llvmlite emulates the some API of llvmpy. This compatibility layer is enough to allow numba to transition to llvmlite with minimal code changes. Keep in mind that this compatibility layer is temporary. New code should be written for the llvmlite API, which is not very different.

Home page


This package has been tested with LLVM 3.3, Python 2.6, 2.7, 3.3 and 3.4. Other Python versions may work.


  1. Get and extract LLVM 3.3 source tarball from Then, cd into the extracted directory.

  2. Run ./configure --enable-optimized --prefix=LLVM_INSTALL_PATH.

    Note: Without the --enable-optimized flag, debug build will be selected. Unless you are developing LLVM or llvmpy, it is recommended that the flag is used to reduce build time and binary size.

    Note: Use prefix to select the installation path. It is recommended to separate your custom build from the default system package. Please replace LLVM_INSTALL_PATH with your own path.

  3. Run REQUIRES_RTTI=1 make install to build and install.

    Note: With LLVM 3.3, the default build configuration has C++ RTTI disabled. However, llvmpy requires RTTI.

    Note: Use make -j2 install to enable concurrent build. Replace 2 with the actual number of processor you have.

  4. Get llvm-py and install it:

    $ git clone
    $ cd llvmpy
    $ LLVM_CONFIG_PATH=LLVM_INSTALL_PATH/bin/llvm-config python install

    Note: Some OS has a default python that may install to system locations thus requiring root permission. In that case, use:

    $ LLVM_CONFIG_PATH=LLVM_INSTALL_PATH/bin/llvm-config python install --user

    Run the tests:

    $ python -c "import llvm; llvm.test()"
  5. See documentation at '' and examples under 'test'.

Ubuntu 14.04 installation instructions

To install llvmpy with pip on ubuntu 14.04, follow these steps:

  1. Make sure both the system version of llvm and version 3.3 is installed:

    $ sudo apt-get install llvm llvm-3.3
  2. Install the non-released package of llvmpy that has support for multiple versions of llvm (as described in #126):

    $ pip install

Common Build Problems

  1. If llvmpy cannot be imported due to "undefined symbol: _ZTIN4llvm24PassRegistrationListenerE", it is because RTTI is not enabled when building LLVM. "_ZTIN4llvm24PassRegistrationListenerE" is the typeinfo of PassRegistrationListener class.
  2. LLVM3.3 ssize_t mismatch on 64-bit Windows. Get patch from
  3. OSX 10.9 Mavericks uses libc++ by default but Anaconda distributes LLVM binaries link with the old libstdc++. The two binaries are incompatible but there are no compile/link time warnings. The resulting binaries may generate segmentation fault at runtime (probably due to ABI mismatch). The Fix: Use the following c++ flags: -std=libstdc++ -mmacosx-version-min=10.6.
  4. OSX 10.10 user will need to change the Makefile of LLVM 3.3 due to a version match error. At line 574 of llvm3.3 Makefile.rules, modify DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]).*/\1/') to DARWIN_VERSION := $(shell echo $(DARWIN_VERSION)| sed -E 's/(10.[0-9]+).*/\1/') (Note the extra "+" in the regex). See for the original issue.


llvmpy is distributed under the new BSD license, which is similar to the LLVM license itself. See the file called LICENSE for the full license text.

Something went wrong with that request. Please try again.