13
votes

I'm trying to install diagrams (in a cabal sandbox) and it fails during arithmoi installation, giving the following message :

Preprocessing library arithmoi-0.4.1.1...

no location info>:
    Warning: Couldn't figure out LLVM version!
         Make sure you have installed LLVM
ghc: could not execute: opt
Failed to install arithmoi-0.4.1.1
cabal: Error: some packages failed to install:
arithmoi-0.4.1.1 failed during the building phase. The exception was:
ExitFailure 1
diagrams-1.2 depends on arithmoi-0.4.1.1 which failed to install.
diagrams-contrib-1.1.2 depends on arithmoi-0.4.1.1 which failed to install.

I'm not sure why I don't have LLVM backend installed or why It could execute opt. Any idea ? (I'm using GHC 7.6.3 on OS 10.8)

3
Have you installed llvm? If not, get it here. If you have, is opt on your path? Also, you should upgrade your version of GHC. 6.8 is god knows how old.user2407038
I haven't installed llvm. I'll try that. Also what is opt ? I tried many time to upgrade GHC but always endup with library conflict, so I gave up.mb14
I've installed LLVM using brew install llvm. Still get the exact same error message.mb14
@user2407038 about the version, I meant 7.6.3 (but I can't upgrade to 7.8.3)mb14
@mb14: you need to pass flags to get opt. I did brew install llvm --all-targets --with-clang --with-lld --with-python && export PATH=/usr/local/opt/llvm/bin:$PATH and it worked.kgadek

3 Answers

12
votes

You can build arithmoi without LLVM by using cabal install arithmoi -f -llvm.

9
votes
cabal install diagrams --constraint "arithmoi -llvm"

There is a way without specifying the range of version. This worked for me.

2
votes

(own answer: I case someone has the same problem) I solved it by downgrading arithmoi to 4.0.4 by adding the following line in may cabal file :

build-depend: arithmoi >= 0.4 < 0.4.1.1

Had to delete the sandbox and reinstall everything from scratch but worked at the end.