Difference between revisions of "Windows"

From HaskellWiki
Jump to navigation Jump to search
(→‎Special tips and tricks for Windows: Added cygcheck/Dependency Walker tip)
(6 intermediate revisions by 2 users not shown)
Line 24: Line 24:
 
Set C_INCLUDE_PATH=C:\usr\local\include;C:\usr\local\include\SDL
 
Set C_INCLUDE_PATH=C:\usr\local\include;C:\usr\local\include\SDL
 
:(It is advisable to use paths without spaces, because some scripts in the MinGW/MSYS environment have problems with spaces in paths.)<br>
 
:(It is advisable to use paths without spaces, because some scripts in the MinGW/MSYS environment have problems with spaces in paths.)<br>
:For linking the libraries you need to define environment variable LIBRARY_PATH as well, listing the directories where .a and .lib files can be found. In case C++ software must be compiled, define CPLUS_INCLUDE_PATH to list the directories with C++ header files.
+
:For linking the libraries, you need to define environment variable LIBRARY_PATH as well, listing the directories where .a and .lib files can be found. In case C++ software must be compiled, define CPLUS_INCLUDE_PATH to list the directories with C++ header files.
   
* Packages are often delivered as a .tar or .tar.gz file, see [[How to unpack a tar file in windows]]
+
* Packages are often delivered as a .tar or .tar.gz file, see [[How to unpack a tar file in Windows]]
   
 
* To work with/produce DLL files with GHC < 7.0.1, you need dlltool.exe, from the [http://sourceforge.net/projects/mingw/files/ mingw-binutils] package and pexports.exe from the [http://sourceforge.net/projects/mingw/files/ mingw-utils] package. For more information see [http://www.cse.yorku.ca/tdb/_doc.php/userg/man/name/dlltool/section/1 the dlltool manual] and [http://www.willus.com/mingw/yongweiwu_stdcall.html Stdcall and DLL tools of MSVC and MinGW]
 
* To work with/produce DLL files with GHC < 7.0.1, you need dlltool.exe, from the [http://sourceforge.net/projects/mingw/files/ mingw-binutils] package and pexports.exe from the [http://sourceforge.net/projects/mingw/files/ mingw-utils] package. For more information see [http://www.cse.yorku.ca/tdb/_doc.php/userg/man/name/dlltool/section/1 the dlltool manual] and [http://www.willus.com/mingw/yongweiwu_stdcall.html Stdcall and DLL tools of MSVC and MinGW]
Line 37: Line 37:
 
* GUI : [[Gtk2Hs]] - A binding of GTK+ in Haskell. Note: this requires installing [http://www.gtk.org GTK+] on windows.
 
* GUI : [[Gtk2Hs]] - A binding of GTK+ in Haskell. Note: this requires installing [http://www.gtk.org GTK+] on windows.
   
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Win32 Win32] - low levelish bindings to Windows API. Comes with GHC and non-minimal Hugs distribution. [https://github.com/haskell/win32 Win32 darcs repo]
+
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Win32 Win32] - low levelish bindings to Windows API. Comes with GHC and non-minimal Hugs distribution. [https://github.com/haskell/win32 Win32 git repo]
   
 
* [[HDBC-ODBC under Windows]] for database access.
 
* [[HDBC-ODBC under Windows]] for database access.
Line 46: Line 46:
   
 
* If there are DLLs missing from your environment, you can find out which, using [http://cygwin.com/cygwin-ug-net/using-utils.html cygcheck] from the [http://www.cygwin.com/ Cygwin project]. Note, that you will get problems if you have both MinGW and Cygwin in your search path; it is best to specify the full path to cygcheck.exe, or copy cygcheck.exe to some location in the search path.
 
* If there are DLLs missing from your environment, you can find out which, using [http://cygwin.com/cygwin-ug-net/using-utils.html cygcheck] from the [http://www.cygwin.com/ Cygwin project]. Note, that you will get problems if you have both MinGW and Cygwin in your search path; it is best to specify the full path to cygcheck.exe, or copy cygcheck.exe to some location in the search path.
: Another option is [http://www.dependencywalker.com/ Dependency Walker]
+
: Another option is [http://www.dependencywalker.com/ Dependency Walker]; this tool can also be used to find out, in which DLL a crash occurs.
   
 
* [http://www.haskell.org/pipermail/haskell-cafe/2013-February/106436.html Terminal Win32/Building Haskeline/8.3 file issue] (Haskell-cafe)
 
* [http://www.haskell.org/pipermail/haskell-cafe/2013-February/106436.html Terminal Win32/Building Haskeline/8.3 file issue] (Haskell-cafe)
Line 78: Line 78:
 
=== Haskell ===
 
=== Haskell ===
   
Below a list of binary packages for Windows. To be sure you get the last version of each, it is best to download the source from [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage] and compile (except for the Haskell Platform).
+
Below a list of binary packages for Windows. To be sure you get the most recent version of each, it is best to download the source from [http://hackage.haskell.org/packages/archive/pkg-list.html Hackage] and compile (except for the Haskell Platform).
   
[http://www.haskell.org/platform/windows.html The Haskell Platform] [[Haskell Platform | (HaskellWiki page)]], contains GHC and a set of libraries and tools;
+
* [http://www.haskell.org/platform/windows.html The Haskell Platform] [[Haskell Platform | (HaskellWiki page)]], contains GHC and a set of libraries and tools
[http://www.haskell.org/ghc/download_ghc_7_6_1#windows GHC 7.6.1] [[GHC | (HaskellWiki page)]];
+
* [http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-i386-unknown-mingw32.tar.bz2 GHC 7.6.3 for Windows x86], [http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-unknown-mingw32.tar.bz2 GHC 7.6.3 for Windows 64bit] [[GHC | (HaskellWiki page)]]
[http://darcs.net/Binaries Darcs] [[Darcs | (HaskellWiki page)]];
+
* [http://leksah.org/download.html Leksah] [[Leksah | (HaskellWiki page)]]
  +
* [http://darcs.net/Binaries Darcs] [[Darcs | (HaskellWiki page)]]
[http://repetae.net/computer/haskell/DrIFT/drop/ Drift] [http://repetae.net/computer/haskell/DrIFT/ (website)] ;
 
[http://www.haskell.org/haddock/haddock-0.7-Win32.zip Haddock 0.7] (obsolete) [http://www.haskell.org/haddock/ (website)] ;
+
* [http://repetae.net/computer/haskell/DrIFT/drop/ Drift] [http://repetae.net/computer/haskell/DrIFT/ (website)]
[http://www.haskell.org/happy/dist/1.13/happy-1-13.msi Happy 1.13] (obsolete) [http://www.haskell.org/happy/ (website)] ;
+
* [http://www.haskell.org/haddock/haddock-0.7-Win32.zip Haddock 0.7] (obsolete) [http://www.haskell.org/haddock/ (website)]
[ftp://ftp.cs.york.ac.uk/pub/haskell/contrib/hscolour-1.9.zip HsColour 1.9] [http://www.cs.york.ac.uk/fp/darcs/hscolour/ (website)] ;
+
* [http://www.haskell.org/happy/dist/1.13/happy-1-13.msi Happy 1.13] (obsolete) [http://www.haskell.org/happy/ (website)]
[http://cvs.haskell.org/Hugs/pages/downloading.htm WinHugs September 2006] [http://www.haskell.org/hugs/ (website)] ;
+
* [ftp://ftp.cs.york.ac.uk/pub/haskell/contrib/hscolour-1.9.zip HsColour 1.9] [http://www.cs.york.ac.uk/fp/darcs/hscolour/ (website)]
[http://haskell.forkio.com/Home/curl-win32/curl-7.19.4-mingw32.zip?attredirects=0 cURL 7.19.4] [http://haskell.forkio.com/Home/curl-win32/ (website)] ;
+
* [http://cvs.haskell.org/Hugs/pages/downloading.htm WinHugs September 2006] [http://www.haskell.org/hugs/ (website)]
  +
* [http://haskell.forkio.com/Home/curl-win32/curl-7.19.4-mingw32.zip?attredirects=0 cURL 7.19.4] [http://haskell.forkio.com/Home/curl-win32/ (website)]
   
 
=== Development ===
 
=== Development ===
Line 96: Line 97:
 
== Shipping Installable Applications ==
 
== Shipping Installable Applications ==
   
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bamse bamse] lets you build windows installers for your Haskell app (MSI).
+
* [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bamse bamse] lets you build windows installers for your Haskell app (MSI).
* [http://www.jrsoftware.org/isinfo.php Inno Setup] is another tool to create windows installers.
+
* [http://www.jrsoftware.org/isinfo.php Inno Setup] is another tool to create windows installers.
  +
* [http://wixtoolset.org/ WiX Toolset], builds Windows installation packages from XML source code
 
  +
* [http://zero-install.sourceforge.net/ Zero Install] creates packages for several platforms ("a decentralised cross-distribution software installation system")
   
 
[[Category:OS]]
 
[[Category:OS]]

Revision as of 13:40, 10 December 2013

Editors

Compilers/interpreters

Tools for compilation

  • As some of the packages contain Unix/Linux specific scripts/commands, you need MinGW and MSYS to simulate a Unix environment. In some cases you need Cygwin instead. If you use msysgit on Windows already, all you need to do is add MinGW to your path.
  • If you need to link to C-software, define environment variable C_INCLUDE_PATH that lists the directories where the header files can be found, for example:
    Set C_INCLUDE_PATH=C:\usr\local\include;C:\usr\local\include\SDL
(It is advisable to use paths without spaces, because some scripts in the MinGW/MSYS environment have problems with spaces in paths.)
For linking the libraries, you need to define environment variable LIBRARY_PATH as well, listing the directories where .a and .lib files can be found. In case C++ software must be compiled, define CPLUS_INCLUDE_PATH to list the directories with C++ header files.
If you have GHC >= 7.0.1, see Using shared libraries or Building and using Win32 DLLs

Libraries

  • GUI : Gtk2Hs - A binding of GTK+ in Haskell. Note: this requires installing GTK+ on windows.
  • Win32 - low levelish bindings to Windows API. Comes with GHC and non-minimal Hugs distribution. Win32 git repo
  • winerror: Error handling for foreign calls to the Windows API

Special tips and tricks for Windows

  • If there are DLLs missing from your environment, you can find out which, using cygcheck from the Cygwin project. Note, that you will get problems if you have both MinGW and Cygwin in your search path; it is best to specify the full path to cygcheck.exe, or copy cygcheck.exe to some location in the search path.
Another option is Dependency Walker; this tool can also be used to find out, in which DLL a crash occurs.
  • Instead of using WinGHCi, one can also run GHCi in shell mode in Emacs — do 'M-x shell' in Emacs, then type 'ghci'.
  • GHCi on Cygwin: When running GHC under a Cygwin shell on Windows, Ctrl-C sometimes doesn't work. A workaround is to use the rlwrap program to invoke GHCi : In addition to proper Ctrl-C, you also get Emacs (or vi) key bindings and command history across sessions, which saves you a load of typing.
  • If a package depends (either directly or indirectly) on the unix package, you cannot compile it on Windows.
A simple way to see, if a package X depends on unix, is giving the command:
   cabal install X --dry-run
This will list all packages that would be installed
  • If you are missing or need to distribute libraries with an application, the correct place to put them is *NOT* in \WINDOWS\System32 as once was the practice in the early days of Windows. All sane applications/installers keep their own private dependencies in the application directory. E.g., if the user has chosen to install your application to C:\Program Files\Foo then it is best to install any DLLs in the same location.
  • When compiling a program with GUI, use the compiler option -optl-mwindows to prevent a DOS-shell being displayed behind your GUI. (This passes the option -mwindows to the linker.)
  • Source files from Unix(-like) systems have lines terminated with Line Feed only; if your favorite editor cannot handle this, you can convert the files to MS-DOS format with the unix2dos command (from the mingw-utils package). For more information, give command: unix2dos --help
Note, that GHC can handle source files in Unix format.
  • To convert a set of files to MS-DOS format (note: this might damage binary files):
C:\MSYS\1.0\bin\find . -type f -exec unix2dos {} ;
Note: the find command included in MSYS is different from the MS-DOS find command, therefore, you need to specify the entire path to this command.

Binary downloads

Haskell

Below a list of binary packages for Windows. To be sure you get the most recent version of each, it is best to download the source from Hackage and compile (except for the Haskell Platform).

Development

CVS 1.11.22 (website) ; Python 2.4.3 (website) ; Scons (website) ; SVN 1.3.2 (website) ; TextPad (website)

Shipping Installable Applications

  • bamse lets you build windows installers for your Haskell app (MSI).
  • Inno Setup is another tool to create windows installers.
  • WiX Toolset, builds Windows installation packages from XML source code
  • Zero Install creates packages for several platforms ("a decentralised cross-distribution software installation system")