[project @ 2001-01-16 10:51:39 by rrt]
[ghc-hetmet.git] / ghc / docs / users_guide / installing.sgml
1 <Chapter id="sec-installing-bin-distrib">
2 <Title>Installing from binary distributions</Title>
3 <IndexTerm><Primary>binary installations</Primary></IndexTerm>
4 <IndexTerm><Primary>installation, of binaries</Primary></IndexTerm>
5
6 <Para>
7 Installing from binary distributions is easiest, and recommended!
8 (Why binaries? Because GHC is a Haskell compiler written in Haskell,
9 so you've got to bootstrap it somehow.  We provide
10 machine-generated C-files-from-Haskell for this purpose, but it's
11 really quite a pain to use them.  If you must build GHC from its
12 sources, using a binary-distributed GHC to do so is a sensible way to
13 proceed. For the other <Literal>fptools</Literal> programs, many are written in Haskell, so binary distributions allow you to install them without having a Haskell compiler.)
14 </Para>
15
16 <Para>This guide is in two parts: installing on Unix-a-likes, and installing on Windows.</Para>
17
18
19 <Sect1><Title>Installing on Unix-a-likes</Title>
20
21 <Sect2>
22 <Title>Bundle structure</Title>
23
24 <Para>
25 <IndexTerm><Primary>bundles of binary stuff</Primary></IndexTerm>
26 </Para>
27
28 <Para>
29 Binary distributions come in &ldquo;bundles,&rdquo; one bundle per file called
30 <Literal>&lt;bundle&gt;-&lt;platform&gt;.tar.gz</Literal>.  (See the building guide for the definition of a platform.)  Suppose that you untar a binary-distribution bundle, thus:
31 </Para>
32
33 <Para>
34
35 <Screen>
36 % cd /your/scratch/space
37 % gunzip &#60; ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -</Screen>
38
39 </Para>
40
41 <Para>
42 Then you should find a single directory, <Literal>fptools</Literal>, with the following
43 structure:
44 </Para>
45
46 <Para>
47 <IndexTerm><Primary>binary distribution, layout</Primary></IndexTerm>
48 <IndexTerm><Primary>directory layout (binary distributions)</Primary></IndexTerm>
49 <VariableList>
50
51 <VarListEntry>
52 <Term><Literal>Makefile.in</Literal></Term>
53 <ListItem>
54 <Para>
55 the raw material from which the <Literal>Makefile</Literal>
56 will be made (<Xref LinkEnd="sec-install">).
57 </Para>
58 </ListItem></VarListEntry>
59 <VarListEntry>
60 <Term><Literal>configure</Literal></Term>
61 <ListItem>
62 <Para>
63 the configuration script (<Xref LinkEnd="sec-install">).
64 </Para>
65 </ListItem></VarListEntry>
66 <VarListEntry>
67 <Term><Literal>README</Literal></Term>
68 <ListItem>
69 <Para>
70 Contains this file summary.
71 </Para>
72 </ListItem></VarListEntry>
73 <VarListEntry>
74 <Term><Literal>INSTALL</Literal></Term>
75 <ListItem>
76 <Para>
77 Contains this description of how to install
78 the bundle.
79 </Para>
80 </ListItem></VarListEntry>
81 <VarListEntry>
82 <Term><Literal>ANNOUNCE</Literal></Term>
83 <ListItem>
84 <Para>
85 The announcement message for the bundle.
86 </Para>
87 </ListItem></VarListEntry>
88 <VarListEntry>
89 <Term><Literal>NEWS</Literal></Term>
90 <ListItem>
91 <Para>
92 release notes for the bundle&mdash;a longer version
93 of <Literal>ANNOUNCE</Literal>.  For GHC, the release notes are contained in the User
94 Guide and this file isn't present.
95 </Para>
96 </ListItem></VarListEntry>
97 <VarListEntry>
98 <Term><Literal>bin/&lt;platform&gt;</Literal></Term>
99 <ListItem>
100 <Para>
101 contains platform-specific executable
102 files to be invoked directly by the user.  These are the files that
103 must end up in your path.
104 </Para>
105 </ListItem></VarListEntry>
106 <VarListEntry>
107 <Term><Literal>lib/&lt;platform&gt;/</Literal></Term>
108 <ListItem>
109 <Para>
110 contains platform-specific support
111 files for the installation.  Typically there is a subdirectory for
112 each <Literal>fptools</Literal> project, whose name is the name of the project with its
113 version number.  For example, for GHC there would be a sub-directory
114 <Literal>ghc-x.xx</Literal>/ where <Literal>x.xx</Literal> is the version number of GHC in the bundle.
115 </Para>
116
117 <Para>
118 These sub-directories have the following general structure:
119 </Para>
120
121 <Para>
122 <VariableList>
123
124 <VarListEntry>
125 <Term><Literal>libHSstd.a</Literal> etc:</Term>
126 <ListItem>
127 <Para>
128 supporting library archives.
129 </Para>
130 </ListItem></VarListEntry>
131 <VarListEntry>
132 <Term><Literal>ghc-iface.prl</Literal> etc:</Term>
133 <ListItem>
134 <Para>
135 support scripts.
136 </Para>
137 </ListItem></VarListEntry>
138 <VarListEntry>
139 <Term><Literal>import/</Literal></Term>
140 <ListItem>
141 <Para>
142 <IndexTerm><Primary>Interface files</Primary></IndexTerm> (<Literal>.hi</Literal>) for the prelude.
143 </Para>
144 </ListItem></VarListEntry>
145 <VarListEntry>
146 <Term><Literal>include/</Literal></Term>
147 <ListItem>
148 <Para>
149 A few C <Literal>&num;include</Literal> files.
150 </Para>
151 </ListItem></VarListEntry>
152 </VariableList>
153 </Para>
154 </ListItem></VarListEntry>
155 <VarListEntry>
156 <Term><Literal>share/</Literal></Term>
157 <ListItem>
158 <Para>
159 contains platform-independent support files
160 for the installation.  Again, there is a sub-directory for each
161 <Literal>fptools</Literal> project.
162 </Para>
163 </ListItem></VarListEntry>
164 <VarListEntry>
165 <Term><Literal>html/</Literal></Term>
166 <ListItem>
167 <Para>
168 contains HTML documentation files (one
169 sub-directory per project).
170 </Para>
171 </ListItem></VarListEntry>
172 <VarListEntry>
173 <Term><Literal>man/</Literal></Term>
174 <ListItem>
175 <Para>
176 contains Unix manual pages.
177 </Para>
178 </ListItem></VarListEntry>
179 </VariableList>
180 </Para>
181
182 <Para>
183 This structure is designed so that you can unpack multiple bundles
184 (including ones from different releases or platforms) into a single
185 <Literal>fptools</Literal> directory
186 <FOOTNOTE>
187
188 <Para>
189 this doesn't work at the
190 moment
191 </Para>
192
193 </FOOTNOTE>
194 :
195 </Para>
196
197 <Para>
198
199 <Screen>
200 % cd /your/scratch/space
201 % gunzip &#60; ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -
202 % gunzip &#60; happy-x.xx-sun-sparc-sunos4.tar.gz | tar xvf -</Screen>
203
204 </Para>
205
206 <Para>
207 When you do multiple unpacks like this, the top level <Literal>Makefile</Literal>,
208 <Literal>README</Literal>, and <Literal>INSTALL</Literal> get overwritten each time.
209 That's fine&mdash;they should be the same.  Likewise, the
210 <Literal>ANNOUNCE-&lt;bundle&gt;</Literal> and <Literal>NEWS-&lt;bundle&gt;</Literal>
211 files will be duplicated across multiple platforms, so they will be
212 harmlessly overwritten when you do multiple unpacks.  Finally, the
213 <Literal>share/</Literal> stuff will get harmlessly overwritten when you do
214 multiple unpacks for one bundle on different platforms.
215 </Para>
216
217 <Sect3 id="sec-install">
218 <Title>Installing</Title>
219
220 <Para>
221 OK, so let's assume that you have unpacked your chosen bundles into a
222 scratch directory <Literal>fptools</Literal>. What next? Well, you will at least need
223 to run the <Literal>configure</Literal><IndexTerm><Primary>configure</Primary></IndexTerm> script by changing your
224 directory to <Literal>fptools</Literal> and typing <Literal>./configure</Literal>.  That should convert
225 <Literal>Makefile.in</Literal> to <Literal>Makefile</Literal>.
226 </Para>
227
228 <Para>
229 <IndexTerm><Primary>installing in-place</Primary></IndexTerm>
230 <IndexTerm><Primary>in-place installation</Primary></IndexTerm>
231 You can now either start using the tools <Emphasis>in-situ</Emphasis> without going
232 through any installation process, just type <Literal>make in-place</Literal> to set the
233 tools up for this. You'll also want to add the path which <Literal>make</Literal> will
234 now echo to your <Literal>PATH</Literal> environment variable. This option is useful if
235 you simply want to try out the package and/or you don't have the
236 necessary privileges (or inclination) to properly install the tools
237 locally. Note that if you do decide to install the package `properly'
238 at a later date, you have to go through the installation steps that
239 follows.
240 </Para>
241
242 <Para>
243 To install an <Literal>fptools</Literal> package, you'll have to do the following:
244 </Para>
245
246 <Para>
247
248 <OrderedList>
249 <ListItem>
250
251 <Para>
252  Edit the <Literal>Makefile</Literal> and check the settings of the following variables:
253
254 <IndexTerm><Primary>directories, installation</Primary></IndexTerm>
255 <IndexTerm><Primary>installation directories</Primary></IndexTerm>
256
257 <VariableList>
258
259 <VarListEntry>
260 <Term><Literal>platform</Literal></Term>
261 <ListItem>
262 <Para>
263 the platform you are going to install for.
264 </Para>
265 </ListItem></VarListEntry>
266 <VarListEntry>
267 <Term><Literal>bindir</Literal></Term>
268 <ListItem>
269 <Para>
270 the directory in which to install user-invokable
271 binaries.
272 </Para>
273 </ListItem></VarListEntry>
274 <VarListEntry>
275 <Term><Literal>libdir</Literal></Term>
276 <ListItem>
277 <Para>
278 the directory in which to install
279 platform-dependent support files.
280 </Para>
281 </ListItem></VarListEntry>
282 <VarListEntry>
283 <Term><Literal>datadir</Literal></Term>
284 <ListItem>
285 <Para>
286 the directory in which to install
287 platform-independent support files.
288 </Para>
289 </ListItem></VarListEntry>
290 <VarListEntry>
291 <Term><Literal>infodir</Literal></Term>
292 <ListItem>
293 <Para>
294 the directory in which to install Emacs info
295 files.
296 </Para>
297 </ListItem></VarListEntry>
298 <VarListEntry>
299 <Term><Literal>htmldir</Literal></Term>
300 <ListItem>
301 <Para>
302 the directory in which to install HTML
303 documentation.
304 </Para>
305 </ListItem></VarListEntry>
306 <VarListEntry>
307 <Term><Literal>dvidir</Literal></Term>
308 <ListItem>
309 <Para>
310 the directory in which to install DVI
311 documentation.
312 </Para>
313 </ListItem></VarListEntry>
314 </VariableList>
315
316 The values for these variables can be set through invocation of the
317 <Command>configure</Command><IndexTerm><Primary>configure</Primary></IndexTerm>
318 script that comes with the distribution, but doing an optical diff to
319 see if the values match your expectations is always a Good Idea.
320 </para>
321
322 <para>
323 <Emphasis>Instead of running <Command>configure</Command>, it is
324 perfectly OK to copy <Filename>Makefile.in</Filename> to
325 <Filename>Makefile</Filename> and set all these variables directly
326 yourself.  But do it right!</Emphasis>
327 </Para>
328
329 </ListItem>
330 <ListItem>
331
332 <Para>
333 Run <Literal>make install</Literal>.  This <Emphasis>
334 should</Emphasis> work with ordinary Unix
335 <Literal>make</Literal>&mdash;no need for fancy stuff like GNU
336 <Literal>make</Literal>.
337
338 </Para>
339 </ListItem>
340 <ListItem>
341
342 <Para>
343 <Literal>rehash</Literal> (t?csh or zsh users), so your shell will see the new
344 stuff in your bin directory.
345
346 </Para>
347 </ListItem>
348 <ListItem>
349
350 <Para>
351  Once done, test your &ldquo;installation&rdquo; as suggested in 
352 <XRef LinkEnd="sec-GHC-test">.  Be sure to use a <Literal>-v</Literal>
353 option, so you can see exactly what pathnames it's using.
354
355 If things don't work as expected, check the list of known pitfalls in
356 the building guide.
357 </Para>
358 </ListItem>
359
360 </OrderedList>
361
362 </Para>
363
364 <Para>
365 <IndexTerm><Primary>link, installed as ghc</Primary></IndexTerm>
366 When installing the user-invokable binaries, this installation
367 procedure will install GHC as <Literal>ghc-x.xx</Literal> where <Literal>x.xx</Literal> is the version
368 number of GHC.  It will also make a link (in the binary installation
369 directory) from <Literal>ghc</Literal> to <Literal>ghc-x.xx</Literal>.  If you install multiple versions
370 of GHC then the last one &ldquo;wins&rdquo;, and &ldquo;<Literal>ghc</Literal>&rdquo; will invoke the last
371 one installed.  You can change this manually if you want.  But
372 regardless, <Literal>ghc-x.xx</Literal> should always invoke GHC version <Literal>x.xx</Literal>.
373 </Para>
374
375 </Sect3>
376
377
378 <Sect3>
379 <Title>What bundles there are</Title>
380
381 <Para>
382 <IndexTerm><Primary>bundles, binary</Primary></IndexTerm>
383 There are plenty of &ldquo;non-basic&rdquo; GHC bundles.  The files for them are
384 called <Literal>ghc-x.xx-&lt;bundle&gt;-&lt;platform&gt;.tar.gz</Literal>, where
385 the <Literal>&lt;platform&gt;</Literal> is as above, and <Literal>&lt;bundle&gt;</Literal> is one
386 of these:
387 </Para>
388
389 <Para>
390 <VariableList>
391
392 <VarListEntry>
393 <Term><Literal>prof</Literal>:</Term>
394 <ListItem>
395 <Para>
396 Profiling with cost-centres.  You probably want this.
397 <IndexTerm><Primary>profiling bundles</Primary></IndexTerm>
398 <IndexTerm><Primary>bundles, profiling</Primary></IndexTerm>
399 </Para>
400 </ListItem></VarListEntry>
401 <VarListEntry>
402 <Term><Literal>par</Literal>:</Term>
403 <ListItem>
404 <Para>
405 Parallel Haskell features (sits on top of PVM).
406 You'll want this if you're into that kind of thing.
407 <IndexTerm><Primary>parallel bundles</Primary></IndexTerm>
408 <IndexTerm><Primary>bundles, parallel</Primary></IndexTerm>
409 </Para>
410 </ListItem></VarListEntry>
411 <VarListEntry>
412 <Term><Literal>gran</Literal>:</Term>
413 <ListItem>
414 <Para>
415 The &ldquo;GranSim&rdquo; parallel-Haskell simulator
416 (hmm&hellip; mainly for implementors).
417 <IndexTerm><Primary>bundles, gransim</Primary></IndexTerm>
418 <IndexTerm><Primary>gransim bundles</Primary></IndexTerm>
419 </Para>
420 </ListItem></VarListEntry>
421 <VarListEntry>
422 <Term><Literal>ticky</Literal>:</Term>
423 <ListItem>
424 <Para>
425 &ldquo;Ticky-ticky&rdquo; profiling; very detailed
426 information about &ldquo;what happened when I ran this program&rdquo;&mdash;really
427 for implementors.
428 <IndexTerm><Primary>bundles, ticky-ticky</Primary></IndexTerm>
429 <IndexTerm><Primary>ticky-ticky bundles</Primary></IndexTerm>
430 </Para>
431 </ListItem></VarListEntry>
432 </VariableList>
433 </Para>
434
435 <Para>
436 One likely scenario is that you will grab <Emphasis>two</Emphasis>
437 binary bundles&mdash;basic, and profiling.  We don't usually make the
438 rest, although you can build them yourself from a source distribution.
439 </Para>
440
441 </Sect3>
442
443 <Sect3 id="sec-GHC-test">
444 <Title>Testing that GHC seems to be working
445 </Title>
446
447 <Para>
448 <IndexTerm><Primary>testing a new GHC</Primary></IndexTerm>
449 </Para>
450
451 <Para>
452 The way to do this is, of course, to compile and run <Emphasis>this</Emphasis> program
453 (in a file <Literal>Main.hs</Literal>):
454 </Para>
455
456 <Para>
457
458 <ProgramListing>
459 main = putStr "Hello, world!\n"
460 </ProgramListing>
461
462 </Para>
463
464 <Para>
465 Compile the program, using the <Literal>-v</Literal> (verbose) flag to verify that
466 libraries, etc., are being found properly:
467
468 <Screen>
469 % ghc -v -o hello Main.hs</Screen>
470
471 </Para>
472
473 <Para>
474 Now run it:
475
476 <Screen>
477 % ./hello
478 Hello, world!</Screen>
479
480 </Para>
481
482 <Para>
483 Some simple-but-profitable tests are to compile and run the notorious
484 <Literal>nfib</Literal><IndexTerm><Primary>nfib</Primary></IndexTerm> program, using different numeric types.  Start with
485 <Literal>nfib :: Int -&gt; Int</Literal>, and then try <Literal>Integer</Literal>, <Literal>Float</Literal>, <Literal>Double</Literal>,
486 <Literal>Rational</Literal> and perhaps the overloaded version.  Code for this is
487 distributed in <Literal>ghc/misc/examples/nfib/</Literal> in a source distribution.
488 </Para>
489
490 <Para>
491 For more information on how to &ldquo;drive&rdquo; GHC, either do <Literal>ghc -help</Literal> or
492 consult the User's Guide (distributed in several pre-compiled formats
493 with a binary distribution, or in source form in
494 <Literal>ghc/docs/users&lowbar;guide</Literal> in a source distribution).
495 </Para>
496
497 </Sect3>
498
499 </Sect2>
500
501 </Sect1>
502
503
504 <Sect1 id="sec-install-windows"><Title>Installing on Windows</Title>
505
506 <Para>
507 Getting the Glasgow Haskell Compiler (GHC) to run on Windows platforms can
508 be a bit of a trying experience. This document tries to simplify the task by
509 enumerating the steps you need to follow in order to set up and configure
510 your machine to run GHC.
511 </Para>
512
513 <Sect2><Title>System requirements</Title>
514
515 <Para>
516 An installation of GHC requires about 50M of disk space (which can be lowered by choosing a &ldquo;compact&rdquo; installation). The Cygwin support tools take another 200M or so (though if you really need to this can be halved by installing only the following packages: bash, binutils, cygwin, diff, fileutils, findutils, gcc, grep, make, perl, mingw, sed, textutils, w32api; however, it's fiddly and not recommended). To run GHC
517 comfortably, your machine should have at least 64M of memory.
518 </Para>
519
520 </Sect2>
521
522
523 <Sect2 id="sec-required"><Title>Software required</Title>
524
525 <Para>
526 You need two chunks of software other than GHC itself: the Cygwin toolchain, and Perl.  Here's how to get and install them.
527 </Para>
528
529 <Sect3><Title>The Cygwin toolchain (1.1.x)</Title>
530
531 <Para>
532 At the moment you'll need Cygwin to use GHC. Cygwin dresses up the Win32
533 environment into something more UNIX-like; (notably, it provides
534 <Command>gcc</Command>, <Command>as</Command> and <Command>ld</Command>).
535 You also need Cygwin to use CVS.
536 </Para>
537
538 <Para>
539 Important grungy information about Cygwin:
540 </Para>
541
542 <ItemizedList>
543
544 <ListItem>
545 <Para>
546 Cygwin doesn't deal well with filenames that include
547 spaces. "<Filename>Program Files</Filename>" and "<Filename>Local files</Filename>" are
548 common gotchas.
549 </Para>
550 </ListItem>
551
552 <ListItem>
553 <Para>
554 Cygwin implements a symbolic link as a text file with some
555 magical text in it.  So programs that don't use Cygwin's
556 I/O libraries won't recognise such files as symlinks.  
557 In particular, programs compiled by GHC are meant to be runnable
558 without having Cygwin, so they don't use the Cygwin library, so
559 they don't recognise symlinks.
560 </Para>
561 </ListItem>
562
563 </ItemizedList>
564
565 <Para>
566 Here's how to install Cygwin.
567 </Para>
568
569 <ItemizedList>
570
571 <ListItem>
572 <Para>
573 Install the latest Cygwin 1.1.x from <ULink
574 URL="http://sources.redhat.com/cygwin/">sources.redhat.com/cygwin</ULink>.
575 If you have a pre-1.1 version, you should deinstall this first. Choose DOS
576 text mode. After installation, start up a Cygwin shell and issue the
577 following command:
578
579 <Screen>
580 mount -f c: /</Screen>
581
582 assuming you installed Cygwin at <Filename>C:\cygwin</Filename>; otherwise
583 change the drive and directory as appropriate.
584 </Para>
585 </ListItem>
586
587 <ListItem>
588 <Para>
589 Create <Filename>C:/Temp</Filename> if it doesn't already exist; substitute
590 the drive you installed Cygwin on for <Filename>C:</Filename>).
591 </Para>
592 </ListItem>
593
594 <ListItem>
595 <Para>
596 If you're an Emacs user and want to be able to run <Command>bash</Command>
597 from within a shell buffer, see the <ULink URL="http://www.cs.washington.edu/homes/voelker/ntemacs.html">NT Emacs home page</ULink> for
598 instructions on how to set this up.
599 </Para>
600 </ListItem>
601
602 </ItemizedList>
603
604 </Sect3>
605
606
607 <Sect3><Title>Environment variables</Title>
608
609 <Para>
610 In case you don't already know how to set environment variables on a Windows
611 machine, here's how. On WinNT/Win2k, to edit your <Constant>PATH</Constant>
612 variable (for example), do the following:
613 </Para>
614
615 <ItemizedList>
616 <ListItem><Para>Press Start/Settings/Control Panels</Para></ListItem>
617 <ListItem><Para>Double-click System</Para></ListItem>
618 <ListItem><Para>Press Advanced</Para></ListItem>
619 <ListItem><Para>Press Environment Variables</Para></ListItem>
620 <ListItem><Para>Under System Variables, select <Constant>PATH</Constant></Para></ListItem>
621 <ListItem><Para>Press Edit</Para></ListItem>
622 <ListItem><Para>Add "<Filename>;C:\whatever</Filename>" to the end of the string (for example)</Para></ListItem>
623 <ListItem><Para>Press OK</Para></ListItem>
624 </ItemizedList>
625
626 <Para>
627 Some environment variables are &ldquo;user variables&rdquo; and
628 some are &ldquo;system variables&rdquo;.  I'm not sure of the difference
629 but both are changed though the same dialogue.
630 </Para>
631
632 <Para>
633 In addition, when running <Command>bash</Command>
634 you can set environment variables in your <Filename>.bashrc</Filename> file.
635 But it is better to set your environment variables from the
636 control panel (they get inherited by bash) because then they are visible
637 to applications that aren't started by bash.  For example,
638 when you're invoking CVS (and ssh) via Emacs keybindings;
639 it invokes <Filename>cvs.exe</Filename> without going via bash.
640 </Para>
641
642 <Para>
643 On a Win9x machine you need to edit <Filename>autoexec.bat</Filename> using
644 <Filename>Windows/System/Sysedit</Filename>.  You must reboot to make
645 the new settings take effect.
646 </Para>
647
648 <Para>
649 The following environment variables must be set:
650 </Para>
651
652 <Para>
653 <InformalTable>
654 <TGroup cols="2">
655 <ColSpec Align="Left" Colsep="0">
656 <ColSpec Align="Left" Colsep="0">
657 <TBody>
658
659 <Row>
660 <Entry><Constant>PATH</Constant></Entry>
661 <Entry>System</Entry>
662 <Entry><Para>
663 Add <Filename>C:\usr\bin</Filename>.
664 This should come <Emphasis>before</Emphasis> the Windows system directories
665 (e.g. <Filename>\WINNT\system32</Filename>).
666 </Para></Entry>
667 </Row>
668
669 <Row>
670 <Entry><Constant>SHELL</Constant></Entry>
671 <Entry>User</Entry>
672 <Entry><Para>
673 <Filename>C:/usr/bin/bash</Filename>.
674 </Para></Entry>
675 </Row>
676
677 <Row>
678 <Entry><Constant>HOME</Constant></Entry>
679 <Entry>User</Entry>
680 <Entry><Para>
681 Set to point to your home directory (normally under
682 <Filename>C:/WINNT/Profiles</Filename> on Win2k).  This is where, for example,
683 <Command>bash</Command> will look for your <Filename>.bashrc</Filename>
684 file.
685 </Para></Entry>
686 </Row>
687
688 <Row>
689 <Entry><Constant>MAKE_MODE</Constant></Entry>
690 <Entry>User</Entry>
691 <Entry><Para>
692 Set to <Literal>UNIX</Literal>.  If you don't do
693 this you get very weird messages when you type <Command>make</Command>, such as:
694 </Para><Screen>
695 /c: /c: No such file or directory</Screen></Entry>
696 </Row>
697
698 <Row>
699 <Entry><Constant>TMPDIR</Constant></Entry>
700 <Entry>User</Entry>
701 <Entry><Para>
702 Set to <Filename>C:/Temp</Filename>. For some reason, Win2k invisibly sets this variable to point to a temporary directory in your profile, that contains embedded spaces.  If GHC sees the <Constant>TMPDIR</Constant> variable set, it tries to use it for temporary files, but Cygwin doesn't grok filenames with spaces, so disaster results.
703 </Para><Para>
704 Furthermore, it seems that <Constant>TMPDIR</Constant> must be set to a directory in the same file system in which you invoke GHC.  Otherwise you get very weird messages when you invoke GHC, such as:
705 <Screen>
706 does not exist
707 Action: openFile
708 Reason: file does not exist /Temp/ghc11068.cpp</Screen>
709 We think this is due to a bug in Cygwin.
710 </Para></Entry>
711 </Row>
712 </TBody>
713
714 </TGroup>
715 </InformalTable>
716 </Para>
717
718 <Para>
719 In addition, we've had problems in the past with certain environment
720 variables being set that seem to have bad effects on GHC. If you have
721 installed other systems ported from Unix, you might too. If you get weird
722 inexplicable failures to build GHC, then it might be worth weeding out unused
723 environment variables. Known culprits from the past include
724 <Constant>GCC_EXEC_PREFIX</Constant> and <Constant>INCLUDE</Constant>.
725 </Para>
726
727 </Sect3>
728
729 </Sect2>  <!-- Reqd software -->
730
731
732 <Sect2><Title>Installing GHC</Title>
733
734 <Para>
735 Download the latest GHC distribution:
736 </Para>
737
738 <VariableList>
739
740 <VarListEntry>
741 <Term>ghc-4.08 InstallShield installer, 15M: <ULink
742 URL="http://www.haskell.org/ghc/download.html">http</ULink>
743 </Term>
744
745 <ListItem>
746 <Para>
747 It is packaged up using an installer that should be familiar-looking to
748 Windows users.
749 </Para>
750
751 <Para>
752 Note: The cygwin support for long file names containing
753 spaces is not 100%, so make sure that you install ghc in a directory
754 that has no embedded spaces (i.e., resist the temptation to put it
755 in <Filename>/Program Files/</Filename>!)
756 </Para>
757
758 <Para>
759 When the installer has completed, make sure you add the location of the
760 ghc <Filename>bin/</Filename> directory to your path (e.g.
761 <Filename>/ghc/ghc-4.08/bin </Filename>).
762 You need to do this in order to bring the various GHC binaries into scope.
763 </Para>
764
765 <Para>
766 Note: If you haven't got perl already installed, you will have to manually
767 copy the <Filename>perl.exe</Filename> binary from the ghc
768 <Filename>bin/</Filename> into your <Filename>/bin</Filename> directory
769 before continuing&mdash;the installer will not currently do this.
770 </Para>
771 </ListItem>
772
773 </VarListEntry>
774
775 </VariableList>
776
777 <Para>
778 Make sure that you set all the environment variables described above
779 under Cygwin installation, including <Constant>TMPDIR</Constant>.
780 </Para>
781 <Para>
782 To test the fruits of your labour, try now to compile a simple
783 Haskell program:
784 </Para>
785
786 <Screen>
787 bash$ cat main.hs
788 module Main(main) where
789
790 main = putStrLn "Hello, world!"
791 bash$ ghc -o main main.hs
792 ..
793 bash$ ./main
794 Hello, world!
795 bash$ </Screen>
796
797 <Para>
798 OK, assuming that worked, you're all set. Go forth and write useful
799 Haskell programs :-) If not, consult the installation FAQ (<XRef LinkEnd="winfaq">); if that still doesn't help then please report the problems you're experiencing (see <Xref LinkEnd="wrong">).
800 </Para>
801
802 <Para> Further information on using GHC under Windows can be found in <ULink
803 URL="http://www.dcs.gla.ac.uk/~sof/ghc-win32.html">Sigbj&oslash;rn Finne's
804 pages</ULink>. Note: ignore the installation instructions, which are rather
805 out of date; the <Emphasis>Miscellaneous</Emphasis> section at the bottom of
806 the page is of most interest, covering topics beyond the scope of this
807 manual. </Para>
808
809 </Sect2>
810
811
812 <Sect2 id="winfaq"><title>Installing ghc-win32 FAQ</title>
813
814 <QandASet>
815
816 <QandAEntry>
817
818 <Question>
819 <Para>
820 I'm having trouble with symlinks.
821 </Para>
822 </Question>
823
824 <Answer>
825 <Para>
826 Symlinks only work under Cygwin (<Xref LinkEnd="sec-install">), so binaries
827 not linked to the Cygwin DLL, in particular those built for Mingwin, will not
828 work with symlinks.
829 </Para>
830 </Answer>
831
832 </QandAEntry>
833
834 <QandAEntry>
835
836 <Question>
837 <Para>
838 I'm getting &ldquo;permission denied&rdquo; messages from <Command>rm</Command> or
839 <Command>mv</Command>.
840 </Para>
841 </Question>
842
843 <Answer>
844 <Para>
845 This can have various causes: trying to rename a directory when an Explorer
846 window is open on it tends to fail. Closing the window generally cures the
847 problem, but sometimes its cause is more mysterious, and logging off and back
848 on or rebooting may be the quickest cure.
849 </Para>
850 </Answer>
851
852 </QandAEntry>
853
854 <QandAEntry>
855
856 <Question>
857 <Para>
858 I get errors when trying to build GHC 4.08 with GHC 4.05.
859 </Para>
860 </Question>
861
862 <Answer> <Para> This seems to work better if you don't use
863 <Option>-O</Option> in <Constant>GhcHcOpts</Constant>. It's a bug in 4.05,
864 unfortunately. Anyway, better to install 4.08 binaries and use those.
865 </Para> </Answer>
866
867 </QandAEntry>
868
869 <QandAEntry>
870
871 <Question>
872 <Para>
873 My programs compile fine but do nothing when run.
874 </Para>
875 </Question>
876
877 <Answer> <Para>Some recent versions of the mingw package in Cygwin seem to
878 cause this. mingwin version 20001111-1 works fine; you should be able to
879 select it by clicking on the version number of the mingw package in the list
880 presented by the Cygwin setup program.</Para>
881 </Answer>
882
883 </QAndAEntry>
884
885 </QandASet>
886
887 </Sect2>
888
889 </Sect1>
890
891
892 <Sect1 id="building-docs">
893 <Title>Building the documentation</Title>
894
895 <Para>
896 We use the DocBook DTD, which is widely used. Most shrink-wrapped distributions seem to be broken in one way or another; thanks to heroic efforts by Sven Panne and Manuel Chakravarty, we now support most of them, plus properly installed versions.
897 </Para>
898
899 <Para>
900 Instructions on installing and configuring the DocBook tools follow.
901 </Para>
902
903 <Sect2>
904 <Title>Installing the DocBook tools from RPMs</Title>
905
906 <Para> If you're using a system that can handle RedHat RPM packages, you can
907 probably use the <ULink
908 URL="http://sourceware.cygnus.com/docbook-tools/">Cygnus DocBook
909 tools</ULink>, which is the most shrink-wrapped SGML suite that we could
910 find. You need all the RPMs except for psgml (i.e.
911 <Filename>docbook</Filename>, <Filename>jade</Filename>,
912 <Filename>jadetex</Filename>, <Filename>sgmlcommon</Filename> and
913 <Filename>stylesheets</Filename>). Note that most of these RPMs are
914 architecture neutral, so are likely to be found in a
915 <Filename>noarch</Filename> directory. The SuSE RPMs also work; the RedHat
916 ones <Emphasis>don't</Emphasis> as of version 6.2, but they are easy to fix:
917 just make a symlink from
918 <Filename>/usr/lib/sgml/stylesheets/nwalsh-modular/lib/dblib.dsl</Filename> to
919 <Filename>/usr/lib/sgml/lib/dblib.dsl</Filename>. </Para>
920
921 </Sect2>
922
923
924 <Sect2>
925 <Title>Installing from binaries on Windows</Title>
926
927 <Para>
928 It's a good idea to use Norman Walsh's <ULink
929 URL="http://nwalsh.com/docbook/dsssl/doc/install.html">installation
930 notes</ULink> as a guide. You should get version 3.1 of DocBook, and note
931 that his file <Filename>test.sgm</Filename> won't work, as it needs version
932 3.0. You should unpack Jade into <Filename>\Jade</Filename>, along with the
933 entities, DocBook into <Filename>\docbook</Filename>, and the DocBook
934 stylesheets into <Filename>\docbook\stylesheets</Filename> (so they actually
935 end up in <Filename>\docbook\stylesheets\docbook</Filename>).
936 </Para>
937
938 </Sect2>
939
940
941 <Sect2>
942 <Title>Installing the DocBook tools from source</Title>
943
944 <Sect3>
945 <Title>Jade</Title>
946
947 <Para>
948 Install <ULink URL="http://openjade.sourceforge.net/">OpenJade</ULink> (Windows binaries are available as well as sources). If you want DVI, PS, or PDF then install JadeTeX from the <Filename>dsssl</Filename>
949 subdirectory. (If you get the error:
950
951 <Screen>
952 ! LaTeX Error: Unknown option implicit=false' for package hyperref'.
953 </Screen>
954
955 your version of <Command>hyperref</Command> is out of date; download it from
956 CTAN (<Filename>macros/latex/contrib/supported/hyperref</Filename>), and
957 make it, ensuring that you have first removed or renamed your old copy. If
958 you start getting file not found errors when making the test for
959 <Command>hyperref</Command>, you can abort at that point and proceed
960 straight to <Command>make install</Command>, or enter them as
961 <Filename>../</Filename><Emphasis>filename</Emphasis>.)
962 </Para>
963
964 <Para>
965 Make links from <Filename>virtex</Filename> to <Filename>jadetex</Filename>
966 and <Filename>pdfvirtex</Filename> to <Filename>pdfjadetex</Filename>
967 (otherwise DVI, PostScript and PDF output will not work). Copy
968 <Filename>dsssl/*.{dtd,dsl}</Filename> and <Filename>catalog</Filename> to <Filename>/usr/[local/]lib/sgml</Filename>.
969 </Para>
970
971 </Sect3>
972
973 <Sect3>
974 <Title>DocBook and the DocBook stylesheets</Title>
975
976 <Para>
977 Get a Zip of <ULink
978 URL="http://www.oasis-open.org/docbook/sgml/3.1/index.html">DocBook</ULink> 
979 and install the contents in <Filename>/usr/[local/]/lib/sgml</Filename>.
980 </Para>
981
982 <Para>
983 Get the <ULink URL="http://nwalsh.com/docbook/dsssl/">DocBook
984 stylesheets</ULink> and install in
985 <Filename>/usr/[local/]lib/sgml/stylesheets</Filename> (thereby creating a
986 subdirectory docbook). For indexing, copy or link <Filename>collateindex.pl</Filename> from the DocBook stylesheets archive in <Filename>bin</Filename> into a directory on your <Constant>PATH</Constant>.
987 </Para>
988
989 <Para>
990 Download the <ULink
991 URL="http://www.oasis-open.org/cover/ISOEnts.zip">ISO
992 entities</ULink> into <Filename>/usr/[local/]lib/sgml</Filename>.
993 </Para>
994
995 </Sect3>
996
997 </Sect2>
998
999 <Sect2>
1000 <Title>Configuring the DocBook tools</Title>
1001
1002 <Para>
1003 Once the DocBook tools are installed, the configure script will detect them and set up the build system accordingly. If you have a system that isn't supported, let us know, and we'll try to help.
1004 </Para>
1005
1006 </Sect2>
1007
1008 <Sect2>
1009 <Title>Remaining problems</Title>
1010
1011 <Para>
1012 If you install from source, you'll get a pile of warnings of the form
1013
1014 <Screen>DTDDECL catalog entries are not supported</Screen>
1015
1016 every time you build anything. These can safely be ignored, but if you find them tedious you can get rid of them by removing all the <Constant>DTDDECL</Constant> entries from <Filename>docbook.cat</Filename>.
1017 </Para>
1018
1019 </Sect2>
1020
1021 </Sect1>
1022
1023 </Chapter>
1024
1025 <!-- Emacs stuff:
1026      ;;; Local Variables: ***
1027      ;;; mode: sgml ***
1028      ;;; sgml-parent-document: ("users_guide.sgml" "book" "chapter") ***
1029      ;;; End: ***
1030  -->