Skip to content
Snippets Groups Projects
installing.sgml 99.4 KiB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
<!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">

<Article>

<ArtHeader>

<Title>Building and Installing the Glasgow Functional Programming Tools Suite
Version 4.04</Title>
<Author><OtherName>The GHC Team</OtherName></Author>
<Address><Email>glasgow-haskell-&lcub;users,bugs&rcub;@dcs.gla.ac.uk</Email></Address>
<PubDate>January 2000</PubDate>

<Abstract>

<Para>
This guide is intended for people who want to build or modify
programs from the Glasgow <Literal>fptools</Literal> suite (as distinct from those
who merely want to <Emphasis>run</Emphasis> them). Installation instructions are now provided in the user guide.
</Para>

<Para>
The bulk of this guide applies to building on Unix systems; see <XRef LinkEnd="winbuild"> for Windows notes.
</Para>

</Abstract>

</ArtHeader>


<Sect1 id="sec-getting">
<Title>Getting the Glasgow <Literal>fptools</Literal> suite
</Title>

<Para>
Building the Glasgow tools <Emphasis>can</Emphasis> be complicated, mostly because
there are so many permutations of what/why/how, e.g., ``Build Happy
with HBC, everything else with GHC, leave out profiling, and test it
all on the `real' NoFib programs.''  Yeeps!
</Para>

<Para>
Happily, such complications don't apply to most people.  A few common
``strategies'' serve most purposes.  Pick one and proceed
as suggested:
</Para>

<Para>
<VariableList>

<VarListEntry>
<Term><IndexTerm><Primary>Binary distribution</Primary></IndexTerm>.</Term>
<ListItem>
<Para>
If your only purpose is to install some of the <Literal>fptools</Literal> suite then the easiest thing to do is to get a binary distribution. In the
binary distribution everything is pre-compiled for your particular
machine architecture and operating system, so all you should have to
do is install the binaries and libraries in suitable places. The user guide
describes how to do this.
</Para>

<Para>
A binary distribution may not work for you for two reasons.  First, we
may not have built the suite for the particular architecture/OS
platform you want. That may be due to lack of time and energy (in
which case you can get a source distribution and build from it; see
below).  Alternatively, it may be because we haven't yet ported the
suite to your architecture, in which case you are considerably worse
off.
</Para>

<Para>
The second reason a binary distribution may not be what you want is
if you want to read or modify the souce code.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term><IndexTerm><Primary>Source distribution</Primary></IndexTerm>.</Term>
<ListItem>
<Para>
You have a supported
platform, but (a)&nbsp;you like the warm fuzzy feeling of compiling things
yourself; (b)&nbsp;you want to build something ``extra''&mdash;e.g., a set of
libraries with strictness-analysis turned off; or (c)&nbsp;you want to hack
on GHC yourself.
</Para>

<Para>
A source distribution contains complete sources for one or more
projects in the <Literal>fptools</Literal> suite.  Not only that, but the more awkward
machine-independent steps are done for you.  For example, if you don't
have <Command>flex</Command><IndexTerm><Primary>flex</Primary></IndexTerm> you'll find it convenient that the source
distribution contains the result of running <Command>flex</Command> on the lexical
analyser specification.  If you don't want to alter the lexical
analyser then this saves you having to find and install <Command>flex</Command>. You
will still need a working version of GHC on your machine in order to
compile (most of) the sources, however.
</Para>

<Para>
We make source distributions more frequently than binary
distributions; a release that comes with pre-compiled binaries
is considered a major release, i.e., a release that we have some
confidence will work well by having tested it (more) thoroughly.
</Para>

<Para>
Source-only distributions are either bugfix releases or snapshots of
current state of development. The release has undergone some testing.
Source releases of 4.xx can be compiled up using 2.10 or later.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>Build GHC from intermediate C <Filename>.hc</Filename> files<IndexTerm><Primary>hc files</Primary></IndexTerm>:</Term>
<ListItem>
<Para>
You
need a working GHC to use a source distribution. What if you don't
have a working GHC? Then you have no choice but to ``bootstrap'' up
from the intermediate C (<Filename>.hc</Filename>) files that we provide.  Building GHC
on an unsupported platform falls into this category.  Please see
<Xref LinkEnd="sec-booting-from-C">.
</Para>

<Para>
Once you have built GHC, you can build the other Glasgow tools with
it.
</Para>

<Para>
In theory, you can (could?) build GHC with another Haskell compiler
(e.g., HBC). We haven't tried to do this for ages and it almost
certainly doesn't work any more (for tedious reasons).
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>The CVS repository.</Term>
<ListItem>
<Para>
We make source distributions slightly more often than binary
distributions; but still infrequently.  If you want more up-to-the
minute (but less tested) source code then you need to get access to
our CVS repository.
</Para>

<Para>
All the <Literal>fptools</Literal> source code is held in a CVS repository. CVS is a
pretty good source-code control system, and best of all it works over
the network.
</Para>

<Para>
The repository holds source code only. It holds no mechanically
generated files at all.  So if you check out a source tree from CVS
you will need to install every utility so that you can build all the
derived files from scratch.
</Para>

<Para>
More information about our CVS repository is available at <ULink
URL="http://www.dcs.gla.ac.uk/fp/software/ghc/cvs-cheat-sheet.html"
>The Fptools CVS Cheat Sheet</ULink
>.
</Para>
</ListItem></VarListEntry>
</VariableList>
</Para>

<Para>
If you are going to do any building from sources (either from a source
distribution or the CVS repository) then you need to read all of this
manual in detail.
</Para>

</Sect1>

<Sect1>
<Title>Things to check before you start typing</Title>

<Para>
Here's a list of things to check before you get started.

<OrderedList>
<ListItem>

<Para>
<IndexTerm><Primary>Disk space needed</Primary></IndexTerm>: About 30MB (five hamburgers' worth) of disk space
for the most basic binary distribution of GHC; more for some
platforms, e.g., Alphas.  An extra ``bundle'' (e.g., concurrent
Haskell libraries) might take you to 8&ndash;10 hamburgers.

You'll need over 100MB (say, 20 hamburgers' worth) if you need to
build the basic stuff from scratch.


All of the above are <Emphasis>estimates</Emphasis> of disk-space needs. (I don't yet
know the disk requirements for the non-GHC tools).

</Para>
</ListItem>
<ListItem>

<Para>
Use an appropriate machine, compilers, and things.

SPARC boxes, DEC Alphas running OSF/1, and PCs running Linux, FreeBSD,
or Solaris are all fully supported.  MIPS, AIX, Win32 and HP boxes are
in pretty good shape.  <Xref LinkEnd="sec-port-info">
gives the full run-down on ports or lack thereof.

NOTE: as of version 4.00, we lost a few ports.  All of the x86 ports
are working, as is the Sparc/Solaris port, but the rest will need a
little work.  Please contact us if you can provide hardware cycles
and/or porting expertise.

</Para>
</ListItem>
<ListItem>

<Para>
 Be sure that the ``pre-supposed'' utilities are installed.
<Xref LinkEnd="sec-pre-supposed"> elaborates.

</Para>
</ListItem>
<ListItem>

<Para>
 If you have any problem when building or installing the Glasgow
tools, please check the ``known pitfalls'' (<Xref LinkEnd="sec-build-pitfalls">).  Also check the <ULink
URL="http://www.dcs.gla.ac.uk/fp/software/ghc/ghc-bugs.html"
>known bugs page</ULink>.
<IndexTerm><Primary>known bugs</Primary></IndexTerm>
<IndexTerm><Primary>bugs, known</Primary></IndexTerm>

If you feel there is still some shortcoming in our procedure or
instructions, please report it.

For GHC, please see the bug-reporting section of the User's guide
(separate document), to maximise the usefulness of your report.
<IndexTerm><Primary>bugs, reporting</Primary></IndexTerm>

If in doubt, please send a message to <Email>glasgow-haskell-bugs@dcs.gla.ac.uk</Email>.
<IndexTerm><Primary>bugs, mailing list</Primary></IndexTerm>
</Para>
</ListItem>

</OrderedList>

</Para>

</Sect1>

<Sect1 id="sec-port-info">
<Title>What machines the Glasgow tools run on
</Title>

<Para>
<IndexTerm><Primary>ports, GHC</Primary></IndexTerm>
<IndexTerm><Primary>GHC ports</Primary></IndexTerm>
<IndexTerm><Primary>supported platforms</Primary></IndexTerm>
<IndexTerm><Primary>platforms, supported</Primary></IndexTerm>
</Para>

<Para>
The main question is whether or not the Haskell compiler (GHC) runs on
your platform.
</Para>

<Para>
A ``platform'' is a architecture/manufacturer/operating-system
combination, such as <Literal>sparc-sun-solaris2</Literal>.  Other common ones are
<Literal>alpha-dec-osf2</Literal>, <Literal>hppa1.1-hp-hpux9</Literal>, <Literal>i386-unknown-linux</Literal>,
<Literal>i386-unknown-solaris2</Literal>, <Literal>i386-unknown-freebsd</Literal>,
<Literal>i386-unknown-cygwin32</Literal>, <Literal>m68k-sun-sunos4</Literal>, <Literal>mips-sgi-irix5</Literal>,
<Literal>sparc-sun-sunos4</Literal>, <Literal>sparc-sun-solaris2</Literal>, <Literal>powerpc-ibm-aix</Literal>.
</Para>

<Para>
Bear in mind that certain ``bundles'', e.g. parallel Haskell, may not
work on all machines for which basic Haskell compiling is supported.
</Para>

<Para>
Some libraries may only work on a limited number of platforms; for
example, a sockets library is of no use unless the operating system
supports the underlying BSDisms.
</Para>

<Sect2>
<Title>What platforms the Haskell compiler (GHC) runs on</Title>

<Para>
<IndexTerm><Primary>fully-supported platforms</Primary></IndexTerm>
<IndexTerm><Primary>native-code generator</Primary></IndexTerm>
<IndexTerm><Primary>registerised ports</Primary></IndexTerm>
<IndexTerm><Primary>unregisterised ports</Primary></IndexTerm>
</Para>

<Para>
The GHC hierarchy of Porting Goodness: (a)&nbsp;Best is a native-code
generator; (b)&nbsp;next best is a ``registerised''
port; (c)&nbsp;the bare minimum is an ``unregisterised'' port.
(``Unregisterised'' is so terrible that we won't say more about it).
</Para>

<Para>
We use Sparcs running Solaris 2.5, x86 boxes running FreeBSD and
Linux, and DEC&nbsp;Alphas running OSF/1&nbsp;V2.0, so those are the
``fully-supported'' platforms, unsurprisingly.  All have native-code
generators, for quicker compilations.  The native-code generator for
iX86 platforms (e.g., Linux ELF) is <Emphasis>nearly</Emphasis> working; but is not
turned on by default.
</Para>

<Para>
Here's everything that's known about GHC ports.  We identify platforms
by their ``canonical'' CPU/Manufacturer/OS triple.
</Para>

<Para>
Note that some ports are fussy about which GCC version you use; or
require GAS; or&hellip;
</Para>

<Para>
<VariableList>

<VarListEntry>
<Term>alpha-dec-osf1:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>alpha-dec-osf1: fully supported</Primary></IndexTerm>
</Para>

<Para>
(We have OSF/1 V3.0.) Fully supported, including native-code
generator.  We recommend GCC 2.6.x or later.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>sparc-sun-sunos4:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>sparc-sun-sunos4: fully supported</Primary></IndexTerm>
</Para>

<Para>
Fully supported, including native-code generator.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>sparc-sun-solaris2:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>sparc-sun-solaris2: fully supported</Primary></IndexTerm>
</Para>

<Para>
Fully supported, including native-code generator.  A couple of quirks,
though: (a)&nbsp;the profiling libraries are bizarrely huge when compiled
with object splitting; (b)&nbsp;the default <Command>xargs</Command><IndexTerm><Primary>xargs</Primary></IndexTerm> program is
atrociously bad for building GHC libraries (see <Xref LinkEnd="sec-pre-supposed"> for
details).
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>HP-PA box running HP</Term>
<ListItem>
<Para>
UX 9.x:/
<IndexTerm><Primary>hppa1.1-hp-hpux: registerised port</Primary></IndexTerm>
</Para>

<Para>
Works registerised.  No native-code generator.  For GCC, you're best
off with one of the Utah releases of GCC&nbsp;2.6.3 (`u3' or later), from
<Literal>jaguar.cs.utah.edu</Literal>.  We think a straight GCC 2.7.x works,
too.
</Para>

<Para>
Concurrent/Parallel Haskell probably don't work (yet).
<IndexTerm><Primary>hppa1.1-hp-hpux: concurrent&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>hppa1.1-hp-hpux: parallel&mdash;no</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>i386-*-linux (PCs running Linux&mdash;ELF format):</Term>
<ListItem>
<Para>
<IndexTerm><Primary>i386-*-linux: registerised port</Primary></IndexTerm>
</Para>

<Para>
GHC works registerised.  You <Emphasis>must</Emphasis> have GCC 2.7.x or later.  The
iX86 native-code generator is <Emphasis>nearly</Emphasis> there, but it isn't turned
on by default.
</Para>

<Para>
Profiling works, and Concurrent Haskell works.
<IndexTerm><Primary>i386-*-linux: profiling&mdash;yes</Primary></IndexTerm>
<IndexTerm><Primary>i386-*-linux: concurrent&mdash;yes</Primary></IndexTerm>
Parallel Haskell probably works.
<IndexTerm><Primary>i386-*-linux: parallel&mdash;maybe</Primary></IndexTerm>
</Para>

<Para>
On old Linux a.out systems: should be the same.
<IndexTerm><Primary>i386-*-linuxaout: registerised port</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>i386-*-freebsd (PCs running FreeBSD 2.2 or higher, and
NetBSD/OpenBSD using FreeBSD emulation):</Term>
<ListItem>
<Para>
<IndexTerm><Primary>i386-*-freebsd:registerised port</Primary></IndexTerm> 
</Para>

<Para>
GHC works registerised. Supports same set of bundles as the above.
</Para>

<Para>
<IndexTerm><Primary>i386-*-freebsd: profiling&mdash;yes</Primary></IndexTerm>
<IndexTerm><Primary>i386-*-freebsd: concurrent&mdash;yes</Primary></IndexTerm>
<IndexTerm><Primary>i386-*-freebsd: parallel&mdash;maybe</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>i386-unknown-cygwin32:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>i386-unknown-cygwin32: fully supported</Primary></IndexTerm>
</Para>

<Para>
Fully supported under Win95/NT, including a native code
generator. Requires the <Literal>cygwin32</Literal> compatibility library and a
healthy collection of GNU tools (i.e., gcc, GNU ld, bash etc.)
Profiling works, so does Concurrent Haskell.  
</Para>

<Para>
<IndexTerm><Primary>i386-*-cygwin32: profiling&mdash;yes</Primary></IndexTerm> 
<IndexTerm><Primary>i386-*-cygwin32: concurrent&mdash;yes</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>mips-sgi-irix5:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>mips-sgi-irix5: registerised port</Primary></IndexTerm>
</Para>

<Para>
GHC works registerised (no native-code generator).  I suspect any
GCC&nbsp;2.6.x (or later) is OK.  The GCC that I used was built with
<Option>--with-gnu-as</Option>; turns out that is important!
</Para>

<Para>
Concurrent/Parallel Haskell probably don't work (yet).
Profiling might work, but it is untested.
<IndexTerm><Primary>mips-sgi-irix5: concurrent&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>mips-sgi-irix5: parallel&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>mips-sgi-irix5: profiling&mdash;maybe</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>mips-sgi-irix6:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>mips-sgi-irix6: registerised port</Primary></IndexTerm>
</Para>

<Para>
Thanks to the fine efforts of Tomasz Cholewo <ULink
URL="mailto:tjchol01@mecca.spd.louisville.edu"
>tjchol01@mecca.spd.louisville.edu</ULink
>, GHC works registerised (no
native code generator) under IRIX 6.2 and 6.3. Depends on having a
<ULink
URL="http://mecca.spd.louisville.edu/~tjchol01/software/"
>specially tweaked version of gcc-2.7.2 around</ULink>.
</Para>

<Para>
Profiling works, Concurrent/Parallel Haskell might work (AFAIK, untested).
<IndexTerm><Primary>mips-sgi-irix6: concurrent&mdash;maybe</Primary></IndexTerm>
<IndexTerm><Primary>mips-sgi-irix6: parallel&mdash;maybe</Primary></IndexTerm>
<IndexTerm><Primary>mips-sgi-irix6: profiling&mdash;yes</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>powerpc-ibm-aix:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>powerpc-ibm-aix: registerised port</Primary></IndexTerm>
GHC works registerised (no native-code generator&hellip;yet).
I suspect 2.7.x is what you need together with this.
</Para>

<Para>
Concurrent/Parallel Haskell probably don't work (yet).
Profiling might work, but it is untested.
<IndexTerm><Primary>mips-sgi-irix5: concurrent&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>mips-sgi-irix5: parallel&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>mips-sgi-irix5: profiling&mdash;maybe</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>m68k-apple-macos7 (Mac, using MPW):</Term>
<ListItem>
<Para>
<IndexTerm><Primary>m68k-apple-macos7: historically ported</Primary></IndexTerm>
Once upon a time, David Wright in Tasmania has actually
gotten GHC to run on a Macintosh.  Ditto James Thomson here at Glasgow.
You may be able to get Thomson's from here.  (Not sure that it will
excite you to death, but&hellip;)
</Para>

<Para>
No particularly recent GHC is known to work on a Mac.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>m68k-next-nextstep3:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>m68k-next-nextstep3: historically ported</Primary></IndexTerm>
Carsten Schultz succeeded with a ``registerised'' port of GHC&nbsp;0.29.
There's probably a little bit-rot since then, but otherwise it should
still be fine.
</Para>

<Para>
Concurrent/Parallel Haskell probably won't work (yet).
<IndexTerm><Primary>m68k-next-nextstep3: concurrent&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>m68k-next-nextstep3: parallel&mdash;no</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>m68k-sun-sunos4 (Sun3):</Term>
<ListItem>
<Para>
<IndexTerm><Primary>m68k-sun-sunos4: registerised
port</Primary></IndexTerm> GHC 2.0x and 3.0x haven't been tried on a Sun3.  GHC&nbsp;0.26
worked registerised.  No native-code generator.
</Para>

<Para>
Concurrent/Parallel Haskell probably don't work (yet).
<IndexTerm><Primary>m68k-sun-sunos4: concurrent&mdash;no</Primary></IndexTerm>
<IndexTerm><Primary>m68k-sun-sunos4: parallel&mdash;no</Primary></IndexTerm>
</Para>
</ListItem></VarListEntry>
</VariableList>
</Para>

</Sect2>

<Sect2>
<Title>What machines the other tools run on</Title>

<Para>
Unless you hear otherwise, the other tools work if GHC works.
</Para>

<Para>
Haggis requires Concurrent Haskell to work.
<IndexTerm><Primary>Haggis, Concurrent Haskell</Primary></IndexTerm>
</Para>

</Sect2>

</Sect1>


<Sect1 id="sec-pre-supposed">
<Title>Installing pre-supposed utilities

<IndexTerm><Primary>pre-supposed utilities</Primary></IndexTerm>
<IndexTerm><Primary>utilities, pre-supposed</Primary></IndexTerm></Title>

<Para>
Here are the gory details about some utility programs you may need;
<Command>perl</Command> and <Command>gcc</Command> are the only important ones. (PVM<IndexTerm><Primary>PVM</Primary></IndexTerm> is important
if you're going for Parallel Haskell.)  The <Command>configure</Command><IndexTerm><Primary>configure</Primary></IndexTerm>
script will tell you if you are missing something.
</Para>

<Para>
<VariableList>

<VarListEntry>
<Term>Perl:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: Perl</Primary></IndexTerm>
<IndexTerm><Primary>Perl, pre-supposed</Primary></IndexTerm>
<Emphasis>You have to have Perl to proceed!</Emphasis> Perl is a language quite good
for doing shell-scripty tasks that involve lots of text processing.
It is pretty easy to install.
</Para>

<Para>
Perl&nbsp;5 is required.  For Win32 platforms, we strongly suggest you pick
up a port of Perl&nbsp;5 for <Literal>cygwin32</Literal>, as the common Hip/ActiveWare port
of Perl is Not Cool Enough for our purposes.
</Para>

<Para>
Perl should be put somewhere so that it can be invoked by the <Literal>&num;!</Literal>
script-invoking mechanism. (I believe <Filename>/usr/bin/perl</Filename> is preferred;
we use <Filename>/usr/local/bin/perl</Filename> at Glasgow.)  The full pathname should
may need to be less than 32 characters long on some systems.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>GNU C (<Command>gcc</Command>):</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: GCC (GNU C compiler)</Primary></IndexTerm>
<IndexTerm><Primary>GCC (GNU C compiler), pre-supposed</Primary></IndexTerm>
</Para>

<Para>
Versions 2.7.2.x, 2.8.1 and egcs 1.1.2 are known to work.  Use other
versions at your own risk!
</Para>

<Para>
If your GCC dies with ``internal error'' on some GHC source file,
please let us know, so we can report it and get things improved.
(Exception: on iX86 boxes&mdash;you may need to fiddle with GHC's
<Option>-monly-N-regs</Option> option; see the User's Guide)
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term><Command>xargs</Command> on Solaris2:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>xargs, presupposed (Solaris only)</Primary></IndexTerm>
<IndexTerm><Primary>Solaris: alternative xargs</Primary></IndexTerm>
The GHC libraries are put together with something like:

<ProgramListing>
find bunch-of-dirs -name '*.o' -print | xargs ar q ...
</ProgramListing>

Unfortunately the Solaris <Command>xargs</Command> (the shell-script equivalent
of <Function>map</Function>) only ``bites off'' the <Filename>.o</Filename> files a few at a
time&mdash;with near-infinite rebuilding of the symbol table in
the <Filename>.a</Filename> file.
</Para>

<Para>
The best solution is to install a sane <Command>xargs</Command> from the GNU
findutils distribution.  You can unpack, build, and install the GNU
version in the time the Solaris <Command>xargs</Command> mangles just one GHC
library.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>Autoconf:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: Autoconf</Primary></IndexTerm>
<IndexTerm><Primary>Autoconf, pre-supposed</Primary></IndexTerm>
</Para>

<Para>
GNU Autoconf is needed if you intend to build from the CVS sources, it
is <Emphasis>not</Emphasis> needed if you just intend to build a standard source
distribution.
</Para>

<Para>
Autoconf builds the <Command>configure</Command> script from <Filename>configure.in</Filename> and
<Filename>aclocal.m4</Filename>.  If you modify either of these files, you'll need
Autoconf to rebuild <Filename>configure</Filename>.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term><Command>sed</Command></Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: sed</Primary></IndexTerm>
<IndexTerm><Primary>sed, pre-supposed</Primary></IndexTerm>
You need a working <Command>sed</Command> if you are going to build from sources.  The
build-configuration stuff needs it.  GNU sed version 2.0.4 is no good!
It has a bug in it that is tickled by the build-configuration.  2.0.5
is OK. Others are probably OK too (assuming we don't create too
elaborate configure scripts.)
</Para>
</ListItem></VarListEntry>
</VariableList>
</Para>

<Para>
One <Literal>fptools</Literal> project is worth a quick note at this point, because it
is useful for all the others: <Literal>glafp-utils</Literal> contains several utilities
which aren't particularly Glasgow-ish, but Occasionally Indispensable.
Like <Command>lndir</Command> for creating symbolic link trees.
</Para>

<Sect2 id="pre-supposed-gph-tools">
<Title>Tools for building parallel GHC (GPH)
</Title>

<Para>
<VariableList>

<VarListEntry>
<Term>PVM version 3:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: PVM3 (Parallel Virtual Machine)</Primary></IndexTerm>
<IndexTerm><Primary>PVM3 (Parallel Virtual Machine), pre-supposed</Primary></IndexTerm>
</Para>

<Para>
PVM is the Parallel Virtual Machine on which Parallel Haskell programs
run.  (You only need this if you plan to run Parallel Haskell.
Concurent Haskell, which runs concurrent threads on a uniprocessor
doesn't need it.)  Underneath PVM, you can have (for example) a
network of workstations (slow) or a multiprocessor box (faster).
</Para>

<Para>
The current version of PVM is 3.3.11; we use 3.3.7.  It is readily
available on the net; I think I got it from <Literal>research.att.com</Literal>, in
<Filename>netlib</Filename>.
</Para>

<Para>
A PVM installation is slightly quirky, but easy to do.  Just follow
the <Filename>Readme</Filename> instructions.
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term><Command>bash</Command>:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>bash, presupposed (Parallel Haskell only)</Primary></IndexTerm>
Sadly, the <Command>gr2ps</Command> script, used to convert ``parallelism profiles''
to PostScript, is written in Bash (GNU's Bourne Again shell).
This bug will be fixed (someday).
</Para>
</ListItem></VarListEntry>
</VariableList>
</Para>

</Sect2>

<Sect2 id="pre-supposed-doc-tools">
<Title>Tools for building the Documentation
</Title>

<Para>
The following additional tools are required if you want to format the
documentation that comes with the <Literal>fptools</Literal> projects:
</Para>

<Para>
<VariableList>

<VarListEntry>
<Term>DocBook:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: DocBook</Primary></IndexTerm>
<IndexTerm><Primary>DocBook, pre-supposed</Primary></IndexTerm>
All our documentation is written in SGML, using the DocBook DTD and processed using the <ULink URL="http://sourceware.cygnus.com/docbook-tools/">Cygnus DocBook tools</ULink>, which is the most shrink-wrapped SGML suite
that we could find.  Unfortunately, it's only packaged as RPMs. You can use it to generate HTML (and
hence DVI, PDF and Postscript) and RTF from any
LinuxDoc source file (including this manual).
</Para>
</ListItem></VarListEntry>
<VarListEntry>
<Term>TeX:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: TeX</Primary></IndexTerm>
<IndexTerm><Primary>TeX, pre-supposed</Primary></IndexTerm>
A decent TeX distribution is required if you want to produce printable
documentation.  We recomment teTeX, which includes just about
everything you need.
</Para>
</ListItem></VarListEntry>
</VariableList>
</Para>

</Sect2>

<Sect2 id="pre-supposed-other-tools">
<Title>Other useful tools
</Title>

<Para>
<VariableList>

<VarListEntry>
<Term>Flex:</Term>
<ListItem>
<Para>
<IndexTerm><Primary>pre-supposed: flex</Primary></IndexTerm> 
<IndexTerm><Primary>flex, pre-supposed</Primary></IndexTerm>
</Para>

<Para>
This is a quite-a-bit-better-than-Lex lexer.  Used to build a couple
of utilities in <Literal>glafp-utils</Literal>.  Depending on your operating system,
the supplied <Command>lex</Command> may or may not work; you should get the GNU
version.
</Para>
</ListItem></VarListEntry>
</VariableList>
</Para>

</Sect2>

</Sect1>

<Sect1 id="sec-building-from-source">
<Title>Building from source

<IndexTerm><Primary>Building from source</Primary></IndexTerm>
<IndexTerm><Primary>Source, building from</Primary></IndexTerm></Title>

<Para>
You've been rash enough to want to build some of
the Glasgow Functional Programming tools (GHC, Happy,
nofib, etc.) from source.  You've slurped the source,
from the CVS repository or from a source distribution, and
now you're sitting looking at a huge mound of bits, wondering
what to do next.
</Para>

<Para>
Gingerly, you type <Command>make</Command>.  Wrong already!
</Para>

<Para>
This rest of this guide is intended for duffers like me, who aren't
really interested in Makefiles and systems configurations, but who
need a mental model of the interlocking pieces so that they can make
them work, extend them consistently when adding new software, and lay
hands on them gently when they don't work.
</Para>

<Sect2 id="sec-source-tree">
<Title>Your source tree
</Title>

<Para>
The source code is held in your <Emphasis>source tree</Emphasis>.
The root directory of your source tree <Emphasis>must</Emphasis>
contain the following directories and files:
</Para>

<Para>

<ItemizedList>
<ListItem>

<Para>
<Filename>Makefile</Filename>: the root Makefile.
</Para>
</ListItem>
<ListItem>

<Para>
<Filename>mk/</Filename>: the directory that contains the
main Makefile code, shared by all the
<Literal>fptools</Literal> software.
</Para>
</ListItem>
<ListItem>

<Para>
 <Filename>configure.in</Filename>, <Filename>config.sub</Filename>, <Filename>config.guess</Filename>:
these files support the configuration process.
</Para>
</ListItem>
<ListItem>

<Para>
 <Filename>install-sh</Filename>.
</Para>
</ListItem>

</ItemizedList>

</Para>

<Para>
All the other directories are individual <Emphasis>projects</Emphasis> of the
<Literal>fptools</Literal> system&mdash;for example, the Glasgow Haskell Compiler
(<Literal>ghc</Literal>), the Happy parser generator (<Literal>happy</Literal>), the <Literal>nofib</Literal> benchmark
suite, and so on.  You can have zero or more of these.  Needless to
say, some of them are needed to build others.
</Para>

<Para>
The important thing to remember is that even if you want only one
project (<Literal>happy</Literal>, say), you must have a source tree whose root
directory contains <Filename>Makefile</Filename>, <Filename>mk/</Filename>, <Filename>configure.in</Filename>, and the
project(s) you want (<Filename>happy/</Filename> in this case).  You cannot get by with
just the <Filename>happy/</Filename> directory.
</Para>

</Sect2>

<Sect2>
<Title>Build trees
<IndexTerm><Primary>build trees</Primary></IndexTerm>
<IndexTerm><Primary>link trees, for building</Primary></IndexTerm></Title>

<Para>
While you can build a system in the source tree, we don't recommend it.
We often want to build multiple versions of our software
for different architectures, or with different options (e.g. profiling).
It's very desirable to share a single copy of the source code among
all these builds.
</Para>

<Para>
So for every source tree we have zero or more <Emphasis>build trees</Emphasis>.  Each
build tree is initially an exact copy of the source tree, except that
each file is a symbolic link to the source file, rather than being a
copy of the source file.  There are ``standard'' Unix utilities that
make such copies, so standard that they go by different names:
<Command>lndir</Command><IndexTerm><Primary>lndir</Primary></IndexTerm>, <Command>mkshadowdir</Command><IndexTerm><Primary>mkshadowdir</Primary></IndexTerm> are two (If you
don't have either, the source distribution includes sources for the
X11 <Command>lndir</Command>&mdash;check out <Filename>fptools/glafp-utils/lndir</Filename>). See <Xref LinkEnd="sec-storysofar"> for a typical invocation.
</Para>

<Para>
The build tree does not need to be anywhere near the source tree in
the file system.  Indeed, one advantage of separating the build tree
from the source is that the build tree can be placed in a
non-backed-up partition, saving your systems support people from
backing up untold megabytes of easily-regenerated, and
rapidly-changing, gubbins.  The golden rule is that (with a single
exception&mdash;<XRef LinkEnd="sec-build-config"> <Emphasis>absolutely everything in the build tree is either
a symbolic link to the source tree, or else is mechanically
generated</Emphasis>.  It should be perfectly OK for your build tree to vanish
overnight; an hour or two compiling and you're on the road again.
</Para>

<Para>
You need to be a bit careful, though, that any new files you create
(if you do any development work) are in the source tree, not a build tree!
</Para>

<Para>
Remember, that the source files in the build tree are <Emphasis>symbolic
links</Emphasis> to the files in the source tree.  (The build tree soon
accumulates lots of built files like <Filename>Foo.o</Filename>, as well.)  You
can <Emphasis>delete</Emphasis> a source file from the build tree without affecting
the source tree (though it's an odd thing to do).  On the other hand,
if you <Emphasis>edit</Emphasis> a source file from the build tree, you'll edit the
source-tree file directly.  (You can set up Emacs so that if you edit
a source file from the build tree, Emacs will silently create an
edited copy of the source file in the build tree, leaving the source
file unchanged; but the danger is that you think you've edited the
source file whereas actually all you've done is edit the build-tree
copy.  More commonly you do want to edit the source file.)
</Para>

<Para>
Like the source tree, the top level of your build tree must be (a
linked copy of) the root directory of the <Literal>fptools</Literal> suite.  Inside
Makefiles, the root of your build tree is called
<Constant>&dollar;(FPTOOLS&lowbar;TOP)</Constant><IndexTerm><Primary>FPTOOLS&lowbar;TOP</Primary></IndexTerm>.  In the rest of this document path
names are relative to <Constant>&dollar;(FPTOOLS&lowbar;TOP)</Constant> unless otherwise stated.  For
example, the file <Filename>ghc/mk/target.mk</Filename> is actually
<Filename><Constant>&dollar;(FPTOOLS&lowbar;TOP)</Constant>/ghc/mk/target.mk</Filename>.
</Para>

</Sect2>

<Sect2 id="sec-build-config">
<Title>Getting the build you want
</Title>

<Para>
When you build <Literal>fptools</Literal> you will be compiling code on a particular
<Emphasis>host platform</Emphasis>, to run on a particular <Emphasis>target platform</Emphasis>
(usually the same as the host platform)<IndexTerm><Primary>platform</Primary></IndexTerm>.  The
difficulty is that there are minor differences between different
platforms; minor, but enough that the code needs to be a bit different
for each.  There are some big differences too: for a different
architecture we need to build GHC with a different native-code
generator.
</Para>