Idris on Windows - tdidriksen/Idris-dev GitHub Wiki
Idris works well on Windows using mingw. Installation requires several steps but is straightforward.
(See also: Windows Binaries)
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.
If you don't already have Haskell installed, you will of course need the Haskell platform
- Download mingw-get-inst
- Launch the installer and, when prompted, select the C compiler, C++ compiler, and MSYS components
- Complete installation
- Launch
<mingw root>/msys/1.0/msys.bat - Run
mingw-get install mingw32-gmp
- Download the latest source tarball of libffi from the libffi website
- Extract into a convenient location (for example C:/src/)
- Launch
<mingw root>/msys/1.0/msys.bator reuse the shell from the previous section - cd to the extracted directory and run
./configure && make && make install - cd back into the convenient location and run
cabal unpack libffi. A directory named likelibffi-0.1will be created. - Delete the line
pkgconfig-depends: libffifrom libffi.cabal inside that directory using your favorite editor - cd the MSYS shell into the directory containing libffi.cabal
- Run
cabal install --extra-lib-dirs=/usr/local/lib --extra-include-dirs=/usr/local/include
Note: The LLVM build process requires Python 2 to be in PATH
- Download the LLVM 3.3 source and extract it.
- In the same directory you extracted it to, create a directory named
llvm-build - Using a MSYS shell,
cdtollvm-buildand run../llvm-3.3.src/configure && make && make install
- Download the latest Boehm GC source and extract it.
- In the same directory you extracted it to, create a directory named
gc-build - Using a MSYS shell,
cdtogc-buildand run../gc-7.2/configure && make && make install(where 7.2 is the current version number)
- In a MSYS shell, run
cabal unpack idris. A directory namedidris-*where*is the current Idris version number (e.g.0.9.9) will be created in the current directory. - Open
idris-*/llvm/Makefilein a text editor and add-I/usr/local/includeto the end of the line that starts with CFLAGS, with a space between it and the previous option. -
cdthe MSYS shell intoidris-*and runcabal 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.)
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.