Skip to content
Fendse edited this page Jul 27, 2020 · 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.

Stack (haskell platform tool) installation

Seems to work with 'Stack' now. The below was tested on a clean machine. Stack works by installing a specific compiler and accompanying tools under the build directory.

  1. Download and install Git 64-bit
  2. Download and install Haskell Platform FULL 64 bit - you can follow the final instructions on the page (step 3 adding to cabal config file) but you're not using cabal for this example.
  3. Go someplace and clone git clone https://github.com/idris-lang/Idris-dev.git
  4. cd idris-dev
  5. stack setup (installs a stack-local GHC)
  6. stack init
  7. stack exec -- pacman -Sy make (need a make tool on your path half way through, this gives you one)
  8. stack build or stack install

If you did stack install idris.exe will be on your path (~\AppData\Roaming\Local\Bin)

Manual installation

The installation instructions assume that GHC has already been installed.

Installation

  1. Download and install MSYS2. Choose the 64-bit version.

  2. Open an MSYS2 shell by starting mingw64.exe, located in the directory you installed MSYS2 in, by default C:\msys64.

    • If you have a space in your windows account name, this will fail to make necessary configs

    • If so, set your Windows environment variable HOME to c:\Ming64\Home\YourNameHereNoSpaces

    • You'll still have a problem with spaces at the end of make-install process copying header files - consider another account

    • In your new account edit .bash_profile, and add something that can get you to GHC and Cabal important: make sure there are no hidden newlines when pasting this

      if [ -d "/c/Program Files/Haskell Platform/8.0.2/bin/" ] ; then
          PATH="/c/Program Files/Haskell Platform/8.0.2/bin/:${PATH}"
      fi
      if [ -d "/c/Program Files/Haskell Platform/8.0.2/lib/extralibs/bin/" ] ; then
          PATH="/c/Program Files/Haskell Platform/8.0.2/lib/extralibs/bin/:${PATH}"
      fi
      
  3. Update MSYS2 packages by running pacman -Syu

    • May have to run this a few times, killing console window between runs until you see no action
  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. Clone the Idris repo in a place to your liking and cd to that directory.

  6. 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.

  7. run cabal update (echo $PATH and which cabal are useful for determining whether cabal can be found)

  8. Start the build with make

    • If you have a space in your username, this will fail late in the build/install copying C header files to your windows account; but I think the initial and final EXE will have been built (really just dodge the account with the space).

Note on building a 32-bit version

Building for 32-bit follows the same procedure as for 64-bit, just using the i686 packages and mingw32.exe in MSYS2 instead.

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. This has been fixed in cabal-install 1.22.6.0, which can be installed with cabal install cabal-install.

Clone this wiki locally