WebHome
-
UHC
-
EHC
-
Documentation
-
Features & Status
-
EH examples
-
Feedback
-
News
-
FAQ
Related
-
Ruler
-
Shuffle
-
uulib & uuagc
Old Stuff
-
Previous WebHome
-
AFP2004
Center
Master Program
Center
Home
Courses
People
Projects
Page
Edit Page
Rename Page
Attach File
Printable
Wiki Source
More ...
Web
Recent Changes
Notify Service
News
Page Index
Search
More ...
Wiki
About TWiki
Text Formatting
Registration
Change Password
Reset Password
Users
Groups
Log In
or
Register
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 [[http://www.cygwin.com][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:__ <BR> Start Cygwin and try some Unix commands (but DOS-commands also work), for example: <TABLE><TR><TD bgcolor=#FFFFCC><PRE> ls date dir </PRE></TD></TR></TABLE> 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* <TABLE><TR><TD bgcolor=#FFFFCC><PRE> ls / ls c:/ ls /cygdrive/c </PRE></TD></TR></TABLE> ---+++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: <TABLE><TR><TD bgcolor=#FFFFCC><PRE> mount c: /c mount d: /d </PRE></TD></TR></TABLE> 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 <TABLE><TR><TD bgcolor=#FFFFCC><PRE> export TMP='D:/temp' </PRE></TD></TR></TABLE> (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. [[http://tortoisesvn.tigris.org/][Download Tortoise SVN here]] and install it (as administrator). __to test whether it works:__ <BR> 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: * [[http://www.haskell.org/platform][Download the Haskell platform]] and install it.<BR> It is wise to install the compiler in a directory without spaces in its name, for example *d:\haskell*. __to test whether it works:__ <BR> * Type <B>ghc --help</B> 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: <TABLE><TR><TD bgcolor=#FFFFCC><PRE> square x = x*x main = putStrLn (show (square 5)) </PRE></TD></TR></TABLE> Compile it with *ghc Test.hs* and run it by starting *main.exe*. * If you include a module header in your program, like <TABLE><TR><TD bgcolor=#FFFFCC><PRE> module Test where square x = x*x main = putStrLn (show (square 5)) </PRE></TD></TR></TABLE> 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.<BR> __to test whether it works:__ <BR> * Type <B>cabal --help</B> 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. <TABLE><TR><TD bgcolor=#FFFFCC><PRE> cabal update cabal install uulib --libdir=d:/haskell cabal install uuagc --bindir=c:/cygwin/bin </PRE></TD></TR></TABLE> <A name="ehc"> ---++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 <B>ehc</B> in a convenient place. * Rightclick it in the browser and choose <B>SVN Checkout...</B> from the context menu * Type the following URL: <B>https://subversion.cs.uu.nl/repos/project.UHC.pub/trunk/EHC</B> * 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: <TABLE><TR><TD bgcolor=#FFFFCC><PRE> ./configure make 100/ehc make 100/ehclibs </PRE></TD></TR></TABLE> (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:__ <BR> Type the following commands: <TABLE><TR><TD bgcolor=#FFFFCC><PRE> cd demo ../install/100/bin/ehc.exe hello.hs hello.exe </PRE></TD></TR></TABLE> 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: * Open the cygwin\bin directory (for example *d:\cygwin\bin*) * Rename *make.exe* to *make_old.exe* * Download http://www.cmake.org/files/cygwin/make.exe and save it as *make.exe* in that directory Now the problem should be solved. -- Main.JeroenBransen - 13 Apr 2012