Home > Software design >  How to build llvm-hs from source
How to build llvm-hs from source

Time:04-17

I'm working on parsing large llvm-ir code using haskell & llvm-hs for some research work.

I used gllvm (comment on this post - Getting LLVM IR for a clang/clang project) to convert openssl (libssl) to .bc files and then to .ll using llvm-dis and parsing the .ll file using haskell & llvm-hs.

During this I'm facing this issue - https://github.com/llvm-hs/llvm-hs/issues/282#issue-511780377 -- Missing Function Attribute "NoFree" #282 & unhandled function attribute enum value: FunctionAttributeKind 26 which are basically edge cases not handled by llvm-hs in it's release but fixed in this commit - https://github.com/llvm-hs/llvm-hs/pull/284

initially I had installed llvm-hs using cabal install --lib llvm-hs what I need help with is I'm not sure how to build it from source.

I cloned the llvm-hs repo and checked out to the commit with fix (or latest commit) of branch llvm-9 and added the path of this repo to the $PATH, how do i use cabal to build this from source ? I am working on a small project so it doesn't have a project file or a .cabal file

Please help!

CodePudding user response:

Create a cabal project that depends one llvm-hs and use https://cabal.readthedocs.io/en/3.6/cabal-project.html#specifying-packages-from-remote-version-control-locations to specify the commit.

Note that since that PR is pulling from a fork, you will use the URL of the fork repository, not the main repository.

  • Related