Skip to content
flippac edited this page Aug 26, 2014 · 24 revisions

Idris works well on Windows using mingw. Installation requires several steps but is straightforward.

(See also: Windows Binaries)

Automated installation

There is a PowerShell script that performs an automated build of Idris. It will download MSYS2 and GHC and perform the necessary configuration of MSYS. It requires Powershell 3.0.

To use it create an empty directory to be used for the installation, place the script get-idris.ps1 there and run it from PowerShell. By default it builds a 64-bit Idris, which can be changed in the script. When the script has finished, Idris can be run by starting the mingw32_shell.bat or mingw64_shell.bat (choose the same as the bitness you built with, 64 if you haven't changed anything) and running idris from the shell prompt. The Idris source is in msys/home/<your user name>/idris. It can be updated with git pull and rebuilt with make.

If you want to use Idris outside of the MSYS shell you need to put the Idris executable and gcc in your Windows path environment variable. Idris.exe is in <Your windows home dir>\AppData\Roaming\cabal\bin, gcc is in msys/mingw32/bin or msys/mingw64/bin.

Manual installation

Install Haskell Platform

If you don't already have Haskell installed, you will of course need the Haskell platform

Install MinGW and MSYS

  1. Download mingw-get-inst
  2. Launch the installer and, when prompted, select the C compiler, C++ compiler, and MSYS components
  3. Complete installation

Install libgmp

  1. Launch <mingw root>/msys/1.0/msys.bat
  2. Run mingw-get install mingw32-gmp

Install libffi and Haskell bindings

  1. Download the latest source tarball of libffi from the libffi website
  2. Extract into a convenient location (for example C:/src/)
  3. Launch <mingw root>/msys/1.0/msys.bat or reuse the shell from the previous section
  4. cd to the extracted directory and run ./configure && make && make install
  5. cd back into the convenient location and run cabal unpack libffi. A directory named like libffi-0.1 will be created.
  6. Delete the line pkgconfig-depends: libffi from libffi.cabal inside that directory using your favorite editor
  7. cd the MSYS shell into the directory containing libffi.cabal
  8. Run cabal install --extra-lib-dirs=/usr/local/lib --extra-include-dirs=/usr/local/include

Install LLVM 3.3

Note: The LLVM build process requires Python 2 to be in PATH

  1. Download the LLVM 3.3 source and extract it.
  2. In the same directory you extracted it to, create a directory named llvm-build
  3. Using a MSYS shell, cd to llvm-build and run ../llvm-3.3.src/configure && make && make install

Install Boehm GC

  1. Download the latest Boehm GC source and extract it.
  2. In the same directory you extracted it to, create a directory named gc-build
  3. Using a MSYS shell, cd to gc-build and run ../gc-7.2/configure && make && make install (where 7.2 is the current version number)

Install Idris

  1. In a MSYS shell, run cabal unpack idris. A directory named idris-* where * is the current Idris version number (e.g. 0.9.9) will be created in the current directory.
  2. Open idris-*/llvm/Makefile in a text editor and add -I/usr/local/include to the end of the line that starts with CFLAGS, with a space between it and the previous option.
  3. cd the MSYS shell into idris-* and run cabal install --ghc-options=-pgml=gcc.

The GHC option on the end serves to ensure that linking is done using the system MinGW instead of the Haskell platform MinGW, helping ensure that libraries built using the system MinGW are not linked against the wrong version of libgcc, libc, and/or libstdc++. (If you get undefined reference to 'isascii', it might be worth trying without the --ghc-options flag.)

Run Idris

Idris is now installed and can be launched directly from a MSYS shell by entering idris.

Note that Idris, compiled in this manner, depends on the libffi, libgmp, and pthread DLLs. After completing the above installation procedure, all of these will be available in locations in the MSYS PATH. If you need to run Idris outside of the MSYS path, copy the idris executable and each of the DLLs into a single directory and run it there, or place their locations in the system PATH. The native backends will still require GCC to be in PATH to produce executables.

Clone this wiki locally