[[project @ 2004-03-17 10:44:06 by simonpj] simonpj**20040317104406 More Windows building notes ] { hunk ./docs/building/building.sgml 4343 - -MSYS is a fork of the Cygwin tree, so they -are fundamentally similar. However, MSYS is by design much smaller and simpler. Access to the file system goes -through fewer layers, so MSYS is quite a bit faster too. - - hunk ./docs/building/building.sgml 4350 + hunk ./docs/building/building.sgml 4352 -In contrast, MSYS provides no compilation tools; it relies instead on the MinGW tools. These + +MSYS is a fork of the Cygwin tree, so they +are fundamentally similar. However, MSYS is by design much smaller and simpler. Access to the file system goes +through fewer layers, so MSYS is quite a bit faster too. + + +Furthermore, MSYS provides no compilation tools; it relies instead on the MinGW tools. These hunk ./docs/building/building.sgml 4374 +Targeting MinGW + +We want GHC to compile programs that work on any Win32 system. Hence: + + +GHC does invoke a C compiler, assembler, linker and so on, but we ensure that it only +invokes the MinGW tools, not the Cygwin ones. That means that the programs GHC compiles +will work on any system, but it also means that the programs GHC compiles do not have access +to all of Posix. In particular, they cannot import the (Haskell) Posix +library; they have to do +their input output using standard Haskell I/O libraries, or native Win32 bindings. + We will call a GHC that targets MinGW in this way GHC-mingw. + + + +To make the GHC distribution self-contained, the GHC distribution includes the MinGW gcc, +as, ld, and a bunch of input/output libraries. + + +So GHC targets MinGW, not Cygwin. +It is in principle possible to build a version of GHC, GHC-cygwin, +that targets Cygwin instead. The up-side of GHC-cygwin is +that Haskell programs compiled by GHC-cygwin can import the (Haskell) Posix library. +We do not support GHC-cygwin, however; it is beyond our resources. + + +While GHC targets MinGW, that says nothing about +how GHC is built. We use both MSYS and Cygwin as build environments for +GHC; both work fine, though MSYS is rather lighter weight. + +In your build tree, you build a compiler called ghc-inplace. It +uses the gcc that you specify using the + flag when you run +configure (see below). +The makefiles are careful to use ghc-inplace (not gcc) +to compile any C files, so that it will in turn invoke the correct gcc rather that +whatever one happens to be in your path. However, the makefiles do use whatever ld +and ar happen to be in your path. This is a bit naughty, but (a) they are only +used to glom together .o files into a bigger .o file, or a .a file, +so they don't ever get libraries (which would be bogus; they might be the wrong libraries), and (b) +Cygwin and MinGW use the same .o file format. So its ok. + + + hunk ./docs/building/building.sgml 4445 - - -Building GHC on Windows - -Targeting MinGW - -We want the GHC that we distribute to work on any Win32 system. Hence: - - -GHC does invoke a C compiler, assembler, linker and so on, but we ensure that it only -invokes the MinGW tools, not the Cygwin ones. That means that the programs GHC compiles -will work on any system, but it also means that the programs GHC compiles do not have access -to all of Posix. In particular, they cannot import the (Haskell) Posix -library; they have to do -their input output using standard Haskell I/O libraries, or native Win32 bindings. - We will call a GHC that targets MinGW in this way GHC-mingw. - - - -To make the GHC distribution self-contained, the GHC distribution includes the MinGW gcc, -as, ld, and a bunch of input/output libraries. - - - -It is in principle possible to build a version of GHC that targets Cygwin instead of MinGW; -we will call that GHC-cygwin. The up-side of GHC-cygwin is -that Haskell programs compiled by GHC-cygwin can import the (Haskell) Posix library. -We do not support this build route, however. - - hunk ./docs/building/building.sgml 4477 -Summary - -Notice that "GHC-mingw" means "GHC that targets MinGW". It says nothing about -how that GHC was built. It is entirely possible to have a GHC-mingw that was built -by compiling GHC's Haskell sources with a GHC-cygwin, or vice versa. - -We distribute only a GHC-mingw built by a GHC-mingw; supporting -GHC-cygwin too is beyond our resources. The GHC we distribute -therefore does not require Cygwin to run, nor do the programs it -compiles require Cygwin. - -The instructions that follow describe how to build GHC-mingw. It is -possible to build GHC-cygwin, but it's not a supported route, and the build system might -be flaky. - -In your build tree, you build a compiler called ghc-inplace. It -uses the gcc that you specify using the - flag when you run -configure (see below). -The makefiles are careful to use ghc-inplace (not gcc) -to compile any C files, so that it will in turn invoke the right gcc rather that -whatever one happens to be in your path. However, the makefiles do use whatever ld -and ar happen to be in your path. This is a bit naughty, but (a) they are only -used to glom together .o files into a bigger .o file, or a .a file, -so they don't ever get libraries (which would be bogus; they might be the wrong libraries), and (b) -Cygwin and Mingw use the same .o file format. So its ok. - - hunk ./docs/building/building.sgml 4517 -Notes for building under Windows +Instructions for building under Windows hunk ./docs/building/building.sgml 4520 -This section summarises how to get the utilities you need on your -Win95/98/NT/2000 machine to use CVS and build GHC. Similar notes for +This section gives detailed instructions for how to build +GHC from source on your Windows machine. Similar instructions for hunk ./docs/building/building.sgml 4524 -You should read the GHC installation guide sections on Windows (in the user -guide) before continuing to read these notes. hunk ./docs/building/building.sgml 4525 + +Make sure you read the preceding section on platforms () +before reading section. + + + +Installing and configuring MSYS + + +MSYS is a lightweight alternative to Cygwin. +You don't need MSYS to use GHC, +but you do need it or Cygwin to build GHC. +Here's how to install MSYS. + + +Go to http://www.mingw.org/download.shtml and +download the following (of course, the version numbers will differ): + + The main MSYS package (binary is sufficient): MSYS-1.0.9.exe + + The MSYS developer's toolkit (binary is sufficient): msysDTK-1.0.1.exe. + This provides make, autoconf, + ssh, cvs and probably more besides. + + +Run both executables (in the order given above) to install them. I put them in c:/msys + + + +Set the following environment variables + + PATH: add c:/msys/1.0/bin to your path. (Of course, the version number may differ.) + hunk ./docs/building/building.sgml 4559 + HOME: set to your home directory (e.g. c:/userid). + This is where, among other things, ssh will look for your .ssh directory. + + + SHELL: set to c:/msys/1.0/bin/sh.exe + + + CVS_RSH: set to c:/msys/1.0/bin/ssh.exe. Only necessary if + you are using CVS. + + + MAKE_MODE: set to UNIX. (I'm not certain this is necessary for MSYS.) + + + + + + +Check that the CYGWIN environment variable is not set. It's a bad bug +that MSYS is affected by this, but if you have CYGWIN set to "ntsec ntea", which is right for Cygwin, it +causes the MSYS ssh to bogusly fail complaining that your .ssh/identity +file has too-liberal permissinos. + + + + + hunk ./docs/building/building.sgml 4590 -but you do need it to build GHC. +but you do need it or MSYS to build GHC. hunk ./docs/building/building.sgml 4723 + }