[[project @ 2005-05-18 15:34:27 by simonpj] simonpj**20050518153427 Stuff about building on windows, mainly from Claus ] { hunk ./docs/building/building.xml 4570 -Installing and configuring Cygwin +Installing and configuring Cygwin hunk ./docs/building/building.xml 4573 -The installation process is straightforward; we install it in c:/cygwin. -During the installation dialogue, make sure that you select all of the following: +The installation process is straightforward; we install it in +c:/cygwin. + +You must install enough Cygwin packages to support +building GHC. If you miss out any of these, strange things will happen to you. There are two ways to do this: + +The direct, but laborious way is to +select all of the following packages in the installation dialogue: hunk ./docs/building/building.xml 4588 -If you miss out any of these, strange things will happen to you. To see thse packages, +To see thse packages, hunk ./docs/building/building.xml 4593 + + +The clever way is to point the Cygwin installer at the +ghc-depends package, which is kept at http://haskell.org/ghc/cygwin. +When the Cygwin installer asks you to "Choose a Download Site", choose one of +the +offered mirror sites; and then type "http://haskell.org/ghc/cygwin" into the +"User URL" box and click "Add"; now two sites are selected. (The Cygwin +installer remembers this for next time.) +Click "Next". +In the "Select Packages" dialogue box that follows, click the "+" sign by +"Devel", scroll down to the end of the "Devel" packages, and choose +ghc-depends. +The package ghc-depends will not actually install anything itself, +but forces additional packages to be added by the Cygwin installer. + + + + + hunk ./docs/building/building.xml 4642 - -There are a few other things to do: - - - -By default, cygwin provides the command shell ash -as sh.exe. We have often seen build-system problems that -turn out to be due to bugs in ash -(to do with quoting -and length of command lines). On the other hand bash seems -to be rock solid. -So, in cygwin/bin -remove the supplied sh.exe (or rename it as ash.exe), -and copy bash.exe to sh.exe. -You'll need to do this in Windows Explorer or the Windows cmd shell, because -you can't rename a running program! - - - - - -Some script files used in the make system start with "#!/bin/perl", -(and similarly for sh). Notice the hardwired path! -So you need to ensure that your /bin directory has the following -binaries in it: - - sh - perl - cat - -All these come in Cygwin's bin directory, which you probably have -installed as c:/cygwin/bin. By default Cygwin mounts "/" as -c:/cygwin, so if you just take the defaults it'll all work ok. -(You can discover where your Cygwin -root directory / is by typing mount.) -Provided /bin points to the Cygwin bin -directory, there's no need to copy anything. If not, copy these binaries from the cygwin/bin -directory (after fixing the sh.exe stuff mentioned in the previous bullet). - - - - - -Finally, here are some things to be aware of when using Cygwin: +Here are some things to be aware of when using Cygwin: hunk ./docs/building/building.xml 4661 + + + +Some script files used in the make system start with "#!/bin/perl", +(and similarly for sh). Notice the hardwired path! +So you need to ensure that your /bin directory has at least +sh, perl, and cat in it. +All these come in Cygwin's bin directory, which you probably have +installed as c:/cygwin/bin. By default Cygwin mounts "/" as +c:/cygwin, so if you just take the defaults it'll all work ok. +(You can discover where your Cygwin +root directory / is by typing mount.) +Provided /bin points to the Cygwin bin +directory, there's no need to copy anything. If not, copy these binaries from the cygwin/bin +directory (after fixing the sh.exe stuff mentioned in the previous bullet). + + + + + +By default, cygwin provides the command shell ash +as sh.exe. It seems to be fine now, but in the past we +saw build-system problems that turned out to be due to bugs in ash +(to do with quoting and length of command lines). On the other hand bash seems +to be rock solid. +If this happens to you (which it shouldn't), in cygwin/bin +remove the supplied sh.exe (or rename it as ash.exe), +and copy bash.exe to sh.exe. +You'll need to do this in Windows Explorer or the Windows cmd shell, because +you can't rename a running program! + + hunk ./docs/building/building.xml 4701 -ssh comes with Cygwin, provided you remember to ask for it when -you install Cygwin. (If not, the installer lets you update easily.) Look for openssh -(not ssh) in the Cygwin list of applications! +ssh comes with both Cygwin and MSYS. +(Cygwin note: you need to ask for package openssh (not ssh) +in the Cygwin list of packages; or use the ghc-depends +package -- see Cygwin installation instructions.) hunk ./docs/building/building.xml 4822 -you are likely to get into a mess because their names overlap with Cygwin binaries. +you are likely to get into a mess because their names overlap with Cygwin +binaries. +On the other hand, you do need ld, ar +(and perhaps one or two other things) in your path. The Cygwin ones are fine, +but you must have them; hence needing the Cygwin binutils package. hunk ./docs/building/building.xml 4952 +A Windows build log using Cygwin + +Here is a complete, from-scratch, log of all you need to build GHC using +Cygwin, kindly provided by Claus Reinke. It does not discuss alternative +choices, but it gives a single path that works. + + +- Install some editor (vim, emacs, whatever) + +- Install cygwin (http://www.cygwin.com) + ; i used 1.5.16-1, installed in c:\cygwin + - run 'setup.exe' + Choose a Download Source: + select 'download from internet'; + Select Root Install Directory: + root dir: c:\cygwin; + install for: all users; + default file type: unix + Select Local Package Directory + choose a spare temporary home + Select Your Internet Connection + Use IE5 settings + Choose a Download Site + Choose your preferred main mirror and + Add 'http://www.haskell.org/ghc/cygwin' + Select Packages + In addition to 'Base' (default install), + select 'Devel->ghc-depends' + +- Install mingw (http://www.mingw.org/) + ; i used MinGW-3.1.0-1.exe + ; installed in c:\mingw + - you probably want to add GLUT + ; (http://www.xmission.com/~nate/glut.html) + ; i used glut-3.7.3-mingw32.tar + +- Get recent binary snapshot of ghc-6.4.1 for mingw + ; (http://www.haskell.org/ghc/dist/stable/dist/) + - unpack in c:/ghc + - add C:\ghc\ghc-6.4.1\bin to %PATH% + (Start->Control Panel->System->Advanced->Environment Variables) + +- Get cvs version of ghc + ; also, subscribe to cvs-all@haskell.org, or follow the mailing list + ; archive, in case you checkout a version with problems + ; http://www.haskell.org//pipermail/cvs-all/ + - mkdir c:/fptools; cd c:/fptools + ; (or whereever you want your cvs tree to be) + - export CVSROOT=:pserver:anoncvs@glass.cse.ogi.edu:/cvs + - cvs login + ; pw: cvs + - cvs checkout fpconfig + - cd fptools + - cvs checkout ghc hslibs libraries + +- Build ghc, using cygwin and mingw, targetting mingw + - export PATH=/cygdrive/c/ghc/ghc-6.4.1/tools:$PATH + ; for haddock, alex, happy (*) + - export PATH=/cygdrive/c/mingw/bin:$PATH + ; without, we pick up some cygwin tools at best! + - cd c:/fptools/fptools + ; (if you aren't there already) + - autoreconf + - ./configure --host=i386-unknown-mingw32 --with-gcc=C:/Mingw/bin/gcc.exe + ; we use cygwin, but build for windows + - cp mk/build.mk.sample mk/build.mk + - in mk/build.mk: + uncomment line: BuildFlavour = perf + add line: BIN_DIST=1 + add line: SplitObjs = NO + - make 2>&1 | tee make.log + ; always useful to have a log around + +- Package up binary distribution + - make binary-dist Project=Ghc 2>&1 | tee make-bin-dist.log + ; always useful to have a log around + - cd ghc-6.5 + - chmod +x ../distrib/prep-bin-dist-mingw + ; if you're happy with the script's contents (*) + - ../distrib/prep-bin-dist-mingw + ; then tar up, unpack where wanted, and enjoy + + }