Install Ehc Under Windows
Ehc
This is a step-by-step guide to get a working EHC system
on your Windows computer.
You will get the source and all necessary tools, to be able to
experiment with and extend EHC yourself.
You will need tools from six different sources,
so have some patience to install them all.
The good news is that you may find the tools useful in different situations as well.
1. Cygwin: a command line shell
EHC makes use of Unix-style development tools,
like
make and
configure.
For being able to use such command line tools without having to go so far as
to install Linux, you can use Cygwin: a command line shell which comes
with many of the needed development tools.
Install Cygwin
To install Cygwin, go to
the Cygwin website
and download the small (610k) installation program of Cygwin 1.7.1.
During installation it asks for:
- A root directory. As this directory might need to be mentioned in various places, a short path without spaces is recommended, for example d:\cygwin.
- A local package directory. This directory is used to store temporary files during download and installation of Cygwin. Any path will do, for example d:\downloads\cygwin.
- Internet connection type, and mirrorsite to download from. Default choices will do.
- Packages to select: in addition to the default selection, we need the following: Devel/gcc, Devel/make, Interpreters/perl, Interpreters/m4, Utils/file, Web/curl, Web/wget. You may also want to have Publishing/tetex, but you can always add more packages later by starting the installation program again.
After installation you will have a desktop icon and/or an item in the start menu.
to test whether it works:
Start Cygwin and try some Unix commands (but DOS-commands also work), for example:
The root of the file system is the directory that you mentioned during installation.
But you can also access files outside that directory by dusing windows-style paths with colons.
If you want/need to avoid colons, you can adress your C-disk as if it were a subdirectory of
/cygdrive
ls /
ls c:/
ls /cygdrive/c
|
Mount your disks
To have an even more convenient access to your files,
you can mount your disks. We need this in the sequel. Run a Cywin shell as administrator, and type:
and you will be able to address all files on the C- and D-disk as if they were in directories /c and /d.
(Ignore the warning messages).
These command need to be put at the beginning of the .bashrc file (before PATH environment variable is set), or the mount points need to be added to /etc/fstab.
Set environment variable
Edit the file
.bashrc in your Cygwin home directory. Add a line like
(choose a suitable location for temporary files). Make sure that the directory mentioned exists.
2. Tortoise: SVN version management client
EHC is maintained in a collaborative version management
system called Subversion, or SVN.
You need a Subversion client to download files from a repository.
Tortoise offers a graphical user interface to SVN. It integrates in the explorer,
so you will hardly notice it exists as a seprate program: you will just notice
enhanced explorer behaviour.
Download Tortoise SVN here and install it (as administrator).
to test whether it works:
Open the file explorer, and rightclick any directory.
A context menu
Tortoise SVN should be present.
3. Haskell compiler and library manager
GHC: Haskell compiler
The Glasgow Haskell Compiler (GHC) is an industrial-strength Haskell compiler,
including many libraries.
To install it:
- Download the Haskell platform and install it.
It is wise to install the compiler in a directory without spaces in its name, for example d:\haskell.
to test whether it works:
- Type ghc --help at the Cygwin prompt. It should reply with a couple screensful usage information. If it doesn't work, the PATH is probably not right.
- Create a file Test.hs containing a simple Haskell program:
square x = x*x
main = putStrLn (show (square 5))
|
Compile it with ghc Test.hs and run it by starting main.exe.
- If you include a module header in your program, like
module Test where
square x = x*x
main = putStrLn (show (square 5))
|
you should compile it by ghc --make Test.hs
Cabal: Library manager
Cabal is a library manager for Haskell libraries.
It comes standard with the Haskell platform now.
to test whether it works:
- Type cabal --help at the Cygwin prompt. It should reply with a couple screensful usage information.
Some libraries and tools needed
Now use the Cabal library manager to grab additional libraries and tools.
This should be done in administrator mode.
It is wise not to use the default destination, as that path contains spaces which might get us into trouble later.
Better use the d:\haskell diretory (or similar) you created earlier.
cabal update
cabal install uulib --libdir=d:/haskell
cabal install uuagc --bindir=c:/cygwin/bin
|
4. EHC: Extensible Haskell Compiler
Now you are ready to get our Extensible Haskell Compiler, and soon you'll be extending it yourself.
to download:
- Create a directory ehc in a convenient place.
- Rightclick it in the browser and choose SVN Checkout... from the context menu
- Type the following URL: https://subversion.cs.uu.nl/repos/project.UHC.pub/trunk/EHC
- Expect 14.5 Megabytes to be downloaded.
To install the system,
start Cygwin and go to the directory you just created. Then type the following commands:
./configure
make 100/ehc
make 100/ehclibs
|
(The paths may look strange having colons and forward slashes, but this needs really be like this.
Of course, you can adapt the paths if you installed the tools elsewhere).
Then wait a long time (around 40 minutes), as not only the compiler has to be build, but also the supporting development tools
shuffle and
ruler and two third-party libraries:
bgc for garbage collection and
gmp for muliple precision arithmetic.
Note that there are various versions of the compiler, which correspond to various stages of extension.
In the example above, we build version 100 of the compiler, which is the full-feature compiler.
To test whether it works:
Type the following commands:
cd demo
../install/100/bin/ehc.exe hello.hs
hello.exe
|
This will compile and run an hello-world program, using the Bytecode backend.
Alternatively, you can use
--target=C to use the Silly-C backend.
Troubleshooting
If you get an error like "target pattern contains no `%'", perform the following steps:
Now the problem should be solved.
--
JeroenBransen - 13 Apr 2012