Difference between revisions of "GHC under Wine"

From HaskellWiki
Jump to navigation Jump to search
m (Extraneous square brackets.)
Line 33: Line 33:
 
* 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.'''
 
* 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").
 
* 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.
+
* ghci appears to not work at all on Wine-1.4/Linux-x86, but works OK on Wine-1.7.18/i386 and Ubuntu 12.04.5/x86_64.
   
 
===Native DLLs===
 
===Native DLLs===
Line 39: Line 39:
   
 
[http://wiki.winehq.org/winetricks winetricks] can be useful for installing common native dlls or software
 
[http://wiki.winehq.org/winetricks winetricks] can be useful for installing common native dlls or software
  +
  +
=== Code that uses gtk2hs ===
  +
  +
First, install GTK from http://www.gtk.org/download/win32.php, according to the instructions from http://www.haskell.org/haskellwiki/Gtk2Hs/Installation#Windows. For compilation of gtk, sometimes (e.g., on Ubuntu 12.04.5/x86_64 with Wine-1.7.18/i386 and gtk2hs 0.13) one needs to use the flag -f-fmode-binary, as described on https://github.com/gtk2hs/gtk2hs/issues/23#issuecomment-40895472.
  +
  +
However, sometimes the [https://github.com/gtk2hs/gtk2hs/issues/52 following problem is encountered] when compiling a program that uses gtk2hs
  +
  +
setup-Cabal-1.18.1.3-i386-windows-ghc-7.8.3.exe: The pkg-config package x11 is required but it could not be found
  +
  +
The hacky workaround below solved this problem for gtk2hs 0.13. hHe same problem appears on Windows Vista, so it's not Wine-specific.
  +
  +
cp ~/.wine/drive_c/users/mikolaj/gtk/lib/pkgconfig/fontconfig.pc ~/.wine/drive_c/users/mikolaj/gtk/lib/pkgconfig/x11.pc
  +
  +
=== Code that uses Template Haskell ===
  +
  +
TODO
   
 
==Debugging==
 
==Debugging==

Revision as of 18:36, 4 September 2014

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

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.

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)

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 on Wine-1.4/Linux-x86, but works OK on Wine-1.7.18/i386 and Ubuntu 12.04.5/x86_64.

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

Code that uses gtk2hs

First, install GTK from http://www.gtk.org/download/win32.php, according to the instructions from http://www.haskell.org/haskellwiki/Gtk2Hs/Installation#Windows. For compilation of gtk, sometimes (e.g., on Ubuntu 12.04.5/x86_64 with Wine-1.7.18/i386 and gtk2hs 0.13) one needs to use the flag -f-fmode-binary, as described on https://github.com/gtk2hs/gtk2hs/issues/23#issuecomment-40895472.

However, sometimes the following problem is encountered when compiling a program that uses gtk2hs

   setup-Cabal-1.18.1.3-i386-windows-ghc-7.8.3.exe: The pkg-config package x11 is required but it could not be found

The hacky workaround below solved this problem for gtk2hs 0.13. hHe same problem appears on Windows Vista, so it's not Wine-specific.

   cp ~/.wine/drive_c/users/mikolaj/gtk/lib/pkgconfig/fontconfig.pc ~/.wine/drive_c/users/mikolaj/gtk/lib/pkgconfig/x11.pc

Code that uses Template Haskell

TODO

Debugging

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

External Links

GHC at the Wine AppDB