I am using Haskell's GHC to create LLVM code but it cannot find opt
from LLVM. I googled the problem and it was recommended to install LLVM from homebrew, which I did, but there's no opt
binary on my path. I am wondering where I can get it from so I compile LLVM code from GHC?
Asked
Active
Viewed 1,056 times
3

Erik Kaplun
- 37,128
- 15
- 99
- 111

jap
- 617
- 3
- 13
-
jap, do you have Xcode installed? Which version? – osgx Apr 21 '14 at 14:20
-
No, don't have it installed. I just bought a MacBook Air but I did install the CLI tools to get Clang. – jap Apr 21 '14 at 14:23
-
LLVM is not part of OSX. Some version of LLVM is included into Xcode, but I don't know will it support GHC or not. – osgx Apr 21 '14 at 14:28
2 Answers
0
The only solution I found was to download the prebuilt binaries from the LLVM web site: http://llvm.org/releases/download.html

jap
- 617
- 3
- 13
0
Homebrew is quite explicit about how it installs LLVM:
~$ brew install llvm
==> Downloading https://homebrew.bintray.com/bottles/llvm-3.6.2.mavericks.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/llvm-3.6.2.mavericks.bottle.tar.gz
==> Pouring llvm-3.6.2.mavericks.bottle.tar.gz
==> Caveats
LLVM executables are installed in /usr/local/opt/llvm/bin.
Extra tools are installed in /usr/local/opt/llvm/share/llvm.
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/llvm/lib
CPPFLAGS: -I/usr/local/opt/llvm/include
==> Summary
/usr/local/Cellar/llvm/3.6.2: 811 files, 291M
so what I did was simply export PATH=/usr/local/opt/llvm:$PATH
prior to executing any GHC commands that required LLVM.

Erik Kaplun
- 37,128
- 15
- 99
- 111