GHC under Wine

From HaskellWiki
Revision as of 16:05, 5 October 2006 by BrettGiles (talk | contribs) (GHCUnderWine moved to GHC under WINE)

Jump to: navigation, search

GHC runs fairly well under wine. Here's a guide on how to get it working.

Firstly get the letest version of wine from and install it.

Next, grab the latest windows version of GHC from

I used the precompiled version of ghc. It's distributed using MSI which can pose a small problem for wine. Luckily, work has been done on developing a native version of MSI for wine. Get it at and follow the instructions to install it.

Now go to the directory where you've put your download of ghc. install it: wine msiexec.exe /i ghc-VERSION.msi

This should start up the installer and walk you through the installation.

Once it's all done, you should be good to start using GHC. You might want to add GHC to your path. To do this fire up regedit:
wine regedit
and go to HKEY_LOCAL_MACHINE->System->CurrentControlSet->Control->Session Manager->Environment->Path and add GHC's installation to the pathlist. It will probably be something like C:\ghc\ghc-VERSION\bin

Now test it.

Create a simple haskell program to compile. Hello World examples are good. Try compiling it:

$ wine ghc -o hello --make HelloWorld.hs
Chasing modules from: HelloWorld.hs
Compiling Main             ( HelloWorld.hs, HelloWorld.o )
fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored
fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored
Linking ...
Wine exited with a successful status

And try running it:

$ wine hello
Hello, world!
Wine exited with a successful status

If it all works well then you should hopefully be able to compile your haskell programs for windows from wine.

Known Problems

hSetBuffering doesn't seem to work well from terminals. This creates problems with GHCi:

$ wine ghci
WARNING: GHCi invoked via 'ghci.exe' in *nix-like shells (cygwin-bash, in particular)
         doesn't handle Ctrl-C well; use the '' shell wrapper instead
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.2, for Haskell 98.
/ /_\\/ __  / /___| |
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
<stdin>: hSetBuffering: failed (failed to set buffering)
Wine exited with a successful status