llvm-ffi: FFI bindings to the LLVM compiler toolkit.

[ bsd3, code-generation, compilers-interpreters, library ] [ Propose Tags ]

FFI bindings to the LLVM compiler toolkit.

Installation cannot be done fully automatically. It would require Cabal code that is bound to certain Cabal versions and is prone to fail. We give several non-automatic ways that also allow you to choose a particular LLVM version.

First possibility is to point Cabal to the LLVM installation directories manually. On Ubuntu this would look like this:

cabal install --extra-include-dirs=/usr/lib/llvm-9/include --extra-lib-dirs=/usr/lib/llvm-9/lib llvm-ffi

For cabal new-build this does not work, because every package build is bound to all influencing flags. That is, if you build, say llvm-tf, it depends on llvm-ffi without the extra-lib-dirs flag. In order to solve this problem, you may specify the extra directories in the global Cabal configuration. I.e. you may add the following lines to .cabal/config:

extra-include-dirs: /usr/lib/llvm-9/include
extra-lib-dirs: /usr/lib/llvm-9/lib

You can store such paths permanently in a pkg-config file like llvm.pc. The optimal way would be if LLVM installations or GNU/Linux distributions would contain such a file, but they don't. Instead, you may generate it using the llvm-pkg-config package or write one manually. Then you run

cabal install -fpkgConfig

We try to stay up to date with LLVM releases. The current version of this package is compatible with LLVM 3.9-9. Please understand that the package may or may not work against older LLVM releases.

Warning for inplace builds: Re-configuring the package using, say -fllvm600, and re-buildung it might result in corrupt code. You must make sure that the stuff in cbits is re-compiled. Cabal or GHC may forget about that. You are safe if you run cabal clean.

Versions [RSS] [faq] 3.0.0,,, 3.1.0, 3.2.0, 3.2.1, 3.3.0, 3.4.0, 3.5.0, 3.5.1, 3.6.0, 3.7.0, 3.8.0, 3.8.1,,, 3.9.0, 3.9.1, 9.0.0, 9.1.0,
Dependencies base (>=3 && <5), enumset (>=0.0.5 && <0.2) [details]
License BSD-3-Clause
Author Henning Thielemann, Bryan O'Sullivan, Lennart Augustsson
Maintainer Henning Thielemann <llvm@henning-thielemann.de>
Revised Revision 1 made by HenningThielemann at 2021-07-26T16:40:58Z
Category Compilers/Interpreters, Code Generation
Home page http://haskell.org/haskellwiki/LLVM
Source repo head: darcs get http://hub.darcs.net/thielema/llvm-ffi/
this: darcs get http://hub.darcs.net/thielema/llvm-ffi/ --tag
Uploaded by HenningThielemann at 2020-03-21T10:55:29Z
Distributions NixOS:
Executables llvm-ffi-offset, llvm-ffi-jit, llvm-ffi-host
Downloads 9836 total (44 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs uploaded by user
Build status unknown [no reports yet]



Manual Flags


developer mode - warnings let compilation fail


Build example executables

Automatic Flags

use pkgconfig (llvm.pc) instead of extra-libraries


use llvm-3.x.pc instead of llvm.pc


use LLVM-3.9 instead of latest supported LLVM


use LLVM-4.0 instead of latest supported LLVM


use LLVM-5.0 instead of latest supported LLVM


use LLVM-6.0 instead of latest supported LLVM


use LLVM-7.0 instead of latest supported LLVM


use LLVM-8.0 instead of latest supported LLVM


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees