2.3. Installing ghc-win32 FAQ

2.3.1. Invoking ghc doesn't seem to do anything, it immediately returns without having compiled the input file.
2.3.2. When compiling up the Hello World example, the following happens:
2.3.3. System.getArgs always return the empty list, i.e. the following program always prints “[]”:

2.3.1. Invoking ghc doesn't seem to do anything, it immediately returns without having compiled the input file.

One cause of this is that /bin/sh is missing. To verify, open up a bash session and type ls -l /bin/sh.exe. If sh.exe is reported as not being there, copy bash.exe (which you'll find inside the cygwin installation tree as H-i586-cygwin32/bin/bash.exe) to /bin/sh.exe.

All being well, ghc should then start to function.

2.3.2. When compiling up the Hello World example, the following happens:

bash$ /ghc/ghc-4.05/bin/ghc-4.05 main.hs
<stdin>:0:25: Character literal '{-# LINE 1 "main.hs" -}' too long
<stdin>:0:25:  on input: "'"
bash$ 

or

bash$ /ghc/ghc-4.05/bin/ghc-4.05 main.hs
Program too big fit into memory under NT
bash$ 

The cause of this is that you're using a version of perl that employs the Microsoft cmd/command shell when launching sub-processes to execute system() calls.

The GHC driver really needs a perl which uses a `UNIX'y shell instead, so make sure that the version you're using is of an compatible ilk. In particular, if perl -v reports that you've got a copy of the (otherwise fine) port of perl done by ActiveState, you're in trouble.

If you're stuck with an incompatible perl, the GHC installation comes with a very basic perl binary for you to use. Simply copy it into the /bin directory.

Notice that copying perl.exe into /bin will not cause the GHC install to suddenly start functioning. If you don't want to re-run the InstallShield installer again, you need to edit the following files within the directory tree that the installer created:

bin/ghc-4.xx   -- where xx is the minor release number
bin/stat2resid
bin/hstags
lib/mkdependHS

For each of these files, you need to edit the first line from instead saying #!/path/to/your/other/perl/install to #!/bin/perl. Once that is done, try compiling up the Hello, World example again.

Should you want to pick up a complete installation of a ghc-friendly port of perl instead, a cygwin port is available.

2.3.3. System.getArgs always return the empty list, i.e. the following program always prints “[]”:

module Main(main) where
import qualified System
main = System.getArgs >>= print

This is a bug with the RTS DLL that comes with ghc-4.03. To fix, upgrade to ghc-4.05.