Personal tools

GHC under Wine

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
m (replace link to patch)
m (Extraneous square brackets.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:GHC|WINE]]
+
[[Category:GHC]]
[[GHC]] runs fairly well under Wine. Here's a guide on how to get it working.
+
[[Category:How to]]
  +
[[Category:OS]]
  +
[[GHC]] runs flawlessly under Wine. Here's a guide on how to get it working.
 
==Installation==
 
==Installation==
First, get the latest version of Wine from http://www.winehq.com/site/download and install it.
+
First, get the latest stable version of Wine from your distribution's repository, or from http://www.winehq.com/site/download.
  +
For Mac users, WineBottler works well.
   
Next, grab the latest [[windows]] version of GHC from http://haskell.org/ghc/download.html
+
Next, grab the latest [[Windows]] version of Haskell Platform from http://www.haskell.org/platform/windows.html
+
Installing Haskell is as simple as typing: <code>wine HaskellPlatform-2012.4.0.0-setup.exe</code>
installing ghc is as simple as typing: <code>wine ghc-6.8.2-i386-unknown-mingw32.exe</code>
 
   
 
Once this is all done, you should be good to start using GHC.
 
Once this is all done, you should be good to start using GHC.
Line 12: Line 12:
   
 
Create a simple haskell program to compile. Hello World examples are good. Try compiling it:<br/>
 
Create a simple haskell program to compile. Hello World examples are good. Try compiling it:<br/>
<code><pre>$ wine ghc -o hello --make HelloWorld.hs
+
<code><pre>$ WINEDEBUG=-all wine ghc --make hello.hs
Chasing modules from: HelloWorld.hs
+
[1 of 1] Compiling Main ( hello.hs, hello.o )
Compiling Main ( HelloWorld.hs, HelloWorld.o )
 
fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored
 
fixme:msvcrt:MSVCRT__sopen : pmode 0x01b6 ignored
 
 
Linking ...
 
Linking ...
Wine exited with a successful status</pre></code>
+
</pre></code>
 
And try running it:
 
   
 
<code><pre>$ wine hello
 
<code><pre>$ wine hello
 
Hello, world!
 
Hello, world!
Wine exited with a successful status</pre></code>
+
</pre></code>
 
If it all works well then you should be able to compile your haskell programs for windows with wine.
 
   
  +
If it all works well then you should be able to compile your Haskell programs for windows with GHC on Wine.
   
 
If you encounter specific, reproducible issues that are present in the latest release of wine you should file a bug report with the Wine project http://bugs.winehq.org (so long as one doesn't already exist for the issue)
 
If you encounter specific, reproducible issues that are present in the latest release of wine you should file a bug report with the Wine project http://bugs.winehq.org (so long as one doesn't already exist for the issue)
Line 26: Line 27:
 
== Known problems ==
 
== Known problems ==
   
* removeDirectoryRecursive does not work correctly under most recent Wine - requires a [http://www.winehq.org/pipermail/wine-patches/2008-August/060305.html patch to kernel32] - as such cabal does not work very well without this patch applied.
+
* MSYS does not integrate with MinGW correctly - [http://bugs.winehq.org/show_bug.cgi?id=15949 See Wine bug 15949]
  +
* removeDirectoryRecursive did not work correctly prior to wine-1.1.4-538-g2e8dec4. This most notably broke cabal install. '''Use Wine 1.1.5 or newer.'''
  +
* GHC 6.12.3, Wine 1.2 (from WineBottler) on mac osx leopard: GHC's mingw/bin/gcc.exe exits with a "spawnv failed: errno 2: No such file or directory" error, which breaks cabal install. To work around, replace gcc.exe with a renamed copy of g++.exe, also in that directory ("ghc\bin\mingw> copy g++.exe gcc.exe").
  +
* ghci appears to not work at all here on Wine-1.4/Linux-x86.
   
 
===Native DLLs===
 
===Native DLLs===
Line 35: Line 36:
 
==Debugging==
 
==Debugging==
   
You can enable tracing of various components within Wine to aid in debugging issues with Wine by using [[http://wiki.winehq.org/DebugChannels Wine Debug Channels]].
+
You can enable tracing of various components within Wine to aid in debugging issues with Wine by using [http://wiki.winehq.org/DebugChannels Wine Debug Channels].
   
 
==External Links==
 
==External Links==
   
[[http://appdb.winehq.org/objectManager.php?sClass=application&iId=6691 GHC at the Wine AppDB]]
+
[http://appdb.winehq.org/objectManager.php?sClass=application&iId=6691 GHC at the Wine AppDB]

Latest revision as of 20:39, 6 December 2012

GHC runs flawlessly under Wine. Here's a guide on how to get it working.

Contents

[edit] 1 Installation

First, get the latest stable version of Wine from your distribution's repository, or from http://www.winehq.com/site/download. For Mac users, WineBottler works well.

Next, grab the latest Windows version of Haskell Platform from http://www.haskell.org/platform/windows.html Installing Haskell is as simple as typing: wine HaskellPlatform-2012.4.0.0-setup.exe

Once this is all done, you should be good to start using GHC.

[edit] 2 Testing

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

$ WINEDEBUG=-all wine ghc --make hello.hs
[1 of 1] Compiling Main             ( hello.hs, hello.o )
Linking ...
$ wine hello
Hello, world!

If it all works well then you should be able to compile your Haskell programs for windows with GHC on Wine.

If you encounter specific, reproducible issues that are present in the latest release of wine you should file a bug report with the Wine project http://bugs.winehq.org (so long as one doesn't already exist for the issue)

[edit] 3 Known problems

  • MSYS does not integrate with MinGW correctly - See Wine bug 15949
  • removeDirectoryRecursive did not work correctly prior to wine-1.1.4-538-g2e8dec4. This most notably broke cabal install. Use Wine 1.1.5 or newer.
  • GHC 6.12.3, Wine 1.2 (from WineBottler) on mac osx leopard: GHC's mingw/bin/gcc.exe exits with a "spawnv failed: errno 2: No such file or directory" error, which breaks cabal install. To work around, replace gcc.exe with a renamed copy of g++.exe, also in that directory ("ghc\bin\mingw> copy g++.exe gcc.exe").
  • ghci appears to not work at all here on Wine-1.4/Linux-x86.

[edit] 3.1 Native DLLs

Wine isn't perfect (yet) but does offer a solution for using native dlls, as an alternative to builtin dlls if certain functions are not implemented or are buggy and not yet fixed. To configure this use winecfg where you can specify settings for the ordering of preferences for loading dlls, Builtin only, Native only, Builtin then Native and Native then Builtin.

winetricks can be useful for installing common native dlls or software

[edit] 4 Debugging

You can enable tracing of various components within Wine to aid in debugging issues with Wine by using Wine Debug Channels.

[edit] 5 External Links

GHC at the Wine AppDB