Skip to content
Niklas Larsson edited this page May 20, 2015 · 63 revisions

Idris works well on Windows using MSYS2. 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 MinGHC

  1. Install MinGHC, choose 7.8.4 and 64-bits. There is still a bug for Cabal in 7.10.1 making it hard to install (see note below). Choose to add GHC to the PATH.

Installation

  1. Download and install MSYS2. Choose the 64-bit version.
  2. Open an MSYS2 shell by starting mingw64_shell.bat
  3. Update MSYS2 packages by running pacman -Syu
  4. Install the needed tools with pacman -S make binutils msys2-w32api-runtime mingw-w64-x86_64-gcc mingw-w64-x86_64-pkg-config mingw-w64-x86_64-libffi
  5. Install alex with cabal install alex
  6. Idris needs the CC environment variable to be set to find the C compiler. Add export CC=gcc to ~/.bash_profile. Rerun mingw64_shell.bat to pick up the change or enter the same export on the command line to get it in your currect session.
  7. Clone the Idris repo in a place to your liking and cd to that directory.
  8. Say that you want libffi support by making a custom.mkcontaining CABALFLAGS += -f FFI in the Idris-dev directory. This flag enables use of the FFI from the REPL.
  9. Start the build with make

Note on building a 32-bit version

Building for 32-bit follows mostly the same procedure as for 64-bit, just using the i686 packages and mingw32_shell.bat in MSYS2 instead. Unfortunately the network package fails to build correctly on MSYS2, so you'll have to build that using the msys provided with MinGHC and then switch to MSYS2.

Note on building with GHC 7.10.1

The build can fail on some packages with long names (data-default-instances-*) due to https://github.com/haskell/cabal/issues/2502. A workaround is to install these packages from a local directory: go outside your Idris-dev directory; unpack the affected packages with cabal unpack <package name>; then install them with cabal install <path to dir of the unpacked package>. You have to do the cabal install from inside the Idris-dev directory if you're building in a sandbox.

Clone this wiki locally