6

I'm trying to install the Idris language in an OSX Lion using the installation guide provided on the official tutorial. I have alraedy installed GMP. This is the error I get:

$ cabal install idris
Resolving dependencies...
Configuring libffi-0.1...
cabal: The pkg-config package libffi is required but it could not be found.
[1 of 1] Compiling Main             ( /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/T/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/Setup.hs, /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/T/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/dist/setup/Main.o )
Linking /var/folders/f0/dlx6tl5x18z4k4_vq0fkqtb80000gn/T/llvm-general-3.3.5.0-61662/llvm-general-3.3.5.0/dist/setup/setup ...
setup: The program llvm-config version ==3.3.* is required but it could not be
found.
cabal: Error: some packages failed to install:
idris-0.9.9 depends on llvm-general-3.3.5.0 which failed to install.
libffi-0.1 failed during the configure step. The exception was:
ExitFailure 1
llvm-general-3.3.5.0 failed during the configure step. The exception was:
ExitFailure 1

Trying to install Idris without LLVM produces this error:

$ cabal install idris -f-LLVM
Resolving dependencies...
Configuring libffi-0.1...
cabal: The pkg-config package libffi is required but it could not be found.
cabal: Error: some packages failed to install:
idris-0.9.9 depends on libffi-0.1 which failed to install.
libffi-0.1 failed during the configure step. The exception was:
ExitFailure 1
MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
  • 2
    Looks like you need to install LLVM 3.3. If you have already installed it, make sure that `llvm-config` is in PATH. – Mikhail Glushenkov Sep 04 '13 at 00:25
  • 2
    Alternatively, try `cabal install idris -f-LLVM` to build Idris without the LLVM backend. – Mikhail Glushenkov Sep 04 '13 at 00:28
  • @MikhailGlushenkov llvm-config runs. I'm not sure which LLVM version I have. `caban install idris -f-LLVM` works but now I've got another problem. – MaiaVictor Sep 04 '13 at 00:31
  • @MikhailGlushenkov managed to install Idris after compiling LIBFFI from source ([here](http://sourceware.org/libffi/)), but am I losing something for not using LLVM? – MaiaVictor Sep 04 '13 at 00:36
  • You won't be able to use the (experimental) LLVM backend which was added in the latest release. By default Idris compiles via C IIRC. – Mikhail Glushenkov Sep 04 '13 at 00:37

2 Answers2

6

I was having this same problem on OSX Mavericks. To get Idris to compile, I used homebrew to install gmp, then I had to do 'export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig', and then 'cabal install idris -f-LLVM'. I got the tip to export the PKG_CONFIG_PATH variable from this site:

https://groups.google.com/d/msg/idris-lang/gxcdvRIA2OI/NqKSd4zHkI4J

Mavericks already had libffi installed, and I didn't want to install a second copy from source, which is what the PKG_CONFIG_PATH trick helped me avoid. Do 'brew info libffi' to find the correct path to export. Hopefully someone will create a homebrew formula for Idris soon...

Mike McClurg
  • 61
  • 1
  • 1
  • This is actually not true, you did install a second copy of libffi, namely into /usr/local/Cellar, it's just not linked into `/usr/lib/`. Using `PKG_CONFIG_PATH` you are telling the make process to use `pkgconfig` from libffi, which will generate flags telling the linker/compiler to look into /usr/local/Cellar/... – wires May 06 '14 at 12:43
3

The first error indicates you should install the LLVM development packages of your distribution (not through cabal) and the second indicates you should install the development package for the GCC libffi library. What Linux distribution are you using? Or are you on Windows/Mac?

Dominique Devriese
  • 2,998
  • 1
  • 15
  • 21
  • 2
    I was on Mac. To complement the answer: I've managed to solve both dependency problems by downloading and compiling them directly by source - seems like Homebrew was downloading older versions. – MaiaVictor Sep 04 '13 at 18:56