From: simonpj Date: Wed, 17 Mar 2004 10:44:06 +0000 (+0000) Subject: [project @ 2004-03-17 10:44:06 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~1959 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a34e79f1eb35d135e7d82a700cc77b40f9eb2b88;p=ghc-hetmet.git [project @ 2004-03-17 10:44:06 by simonpj] More Windows building notes --- diff --git a/docs/building/building.sgml b/docs/building/building.sgml index 65db19c..9b21ea6 100644 --- a/docs/building/building.sgml +++ b/docs/building/building.sgml @@ -4341,20 +4341,21 @@ and MSYS: -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. - - - Cygwin comes with compilation tools (gcc, ld and so on), which compile code that has access to all of Posix. The price is that the executables must be dynamically linked with the Cygwin DLL, so that you cannot run a Cywin-compiled program on a machine that doesn't have Cygwin. Worse, Cygwin is a moving target. The name of the main DLL, cygwin1.dll does not change, but the implementation certainly does. Even the interfaces to functions it exports seem to change occasionally. + -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 compile binaries that run with no DLL support, on any Win32 system. However, MSYS does come with all the make-system tools, such as make, autoconf, cvs, ssh etc. To get these, you have to download the @@ -4370,6 +4371,50 @@ not by programs compiled under MSYS. +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. + + + File names Cygwin, MSYS, and the underlying Windows file system all understand file paths of form c:/tmp/foo. @@ -4397,36 +4442,6 @@ Cygwin programs have a more complicated mount table, and map the lettered drives - - -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. - - HOST_OS vs TARGET_OS @@ -4459,34 +4474,6 @@ So then it doesn't really matter whether you use the HOST_OS or TARGET_OS cpp ma -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. - - Wrapper scripts @@ -4527,22 +4514,80 @@ shortcomings of the native Windows cmd shell. -Notes for building under Windows +Instructions for building under Windows -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 installing and running GHC may be found in the user guide. In general, Win95/Win98 behave the same, and WinNT/Win2k behave the same. -You should read the GHC installation guide sections on Windows (in the user -guide) before continuing to read these notes. + +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.) + + 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. + + + + + Installing and configuring Cygwin You don't need Cygwin to use GHC, -but you do need it to build GHC. +but you do need it or MSYS to build GHC. Install Cygwin from http://www.cygwin.com/. The installation process is straightforward; we install it in c:/cygwin. @@ -4675,6 +4720,7 @@ variable. You can always invoke find with an absolute path, + Configuring SSH ssh comes with Cygwin, provided you remember to ask for it when