[project @ 2005-01-27 18:38:21 by panne]
[ghc-hetmet.git] / docs / building / building.xml
index 5ea951b..b67525f 100644 (file)
@@ -1445,8 +1445,8 @@ $ cvs checkout nofib/spectral</screen>
       <title>Quick Start</title>
 
       <para>If you are starting from a source distribution, and just
-      want a completely standard build, then the following should
-      work:</para>
+      want a completely standard build, then the following procedure should 
+      work (unless you're on Windows, in which case go to <xref linkend="winbuild" />).</para>
 
 <screen>$ autoreconf
 $ ./configure
@@ -2752,8 +2752,8 @@ directive.
              </varlistentry>
 
              <varlistentry>
-               <term><literal>EXCLUDE_SRCS</literal>
-                  <indexterm><primary><literal>EXCLUDE_SRCS</literal></primary></indexterm>
+               <term><literal>EXCLUDED_SRCS</literal>
+                  <indexterm><primary><literal>EXCLUDED_SRCS</literal></primary></indexterm>
                 </term>
                <listitem>
                  <para>Set to a list of source files (relative to the
@@ -2771,7 +2771,7 @@ directive.
 
              <varlistentry>
                <term><literal>EXTRA_SRCS</literal>
-                  <indexterm><primary><literal>EXCLUDE_SRCS</literal></primary></indexterm>
+                  <indexterm><primary><literal>EXTRA_SRCS</literal></primary></indexterm>
                 </term>
                  <listitem>
                  <para>Set to a list of extra source files (perhaps
@@ -3650,6 +3650,13 @@ $ make install</screen>
       <sect3>
        <title>Cross-compiling to produce an unregisterised GHC</title>
 
+       <para>NOTE!  These instructions apply to GHC 6.4 and (hopefully)
+         later.  If you need instructions for an earlier version of GHC, try
+         to get hold of the version of this document that was current at the
+         time.  It should be available from the appropriate download page on
+         the <ulink
+           url="http://www.haskell.org/ghc/">GHC&nbsp;homepage</ulink>.</para>  
+
        <para>In this section, we explain how to bootstrap GHC on a
        new platform, using unregisterised intermediate C files.  We
        haven't put a great deal of effort into automating this
@@ -3689,7 +3696,7 @@ $ ./configure --enable-hc-boot --enable-hc-boot-unregisterised</screen>
   
            <listitem>
 <screen>$ cd <replaceable>T</replaceable>/ghc/includes
-$ make config.h</screen>
+$ make ghcconfig.h</screen>
            </listitem>
          </itemizedlist>
          </listitem>
@@ -3714,13 +3721,16 @@ $ ./configure</screen>
              with the following contents:</para>
 
 <programlisting>GhcUnregisterised = YES
-GhcLibHcOpts = -O -H32m -keep-hc-files
+GhcLibHcOpts = -O -fvia-C -keep-hc-files
+GhcRtsHcOpts = -keep-hc-files
 GhcLibWays =
 SplitObjs = NO
 GhcWithNativeCodeGen = NO
 GhcWithInterpreter = NO
-GhcStage1HcOpts = -O -H32m -fasm
-GhcStage2HcOpts = -O -fvia-C -keep-hc-files</programlisting>
+GhcStage1HcOpts = -O -fasm
+GhcStage2HcOpts = -O -fvia-C -keep-hc-files
+SRC_HC_OPTS += -H32m
+GhcBootLibs = YES</programlisting>
            </listitem>
 
            <listitem>
@@ -3746,7 +3756,7 @@ GhcStage2HcOpts = -O -fvia-C -keep-hc-files</programlisting>
 
            <listitem>
              <para>Copy
-             <filename><replaceable>T</replaceable>/ghc/includes/config.h</filename>
+             <filename><replaceable>T</replaceable>/ghc/includes/ghcconfig.h</filename>
              to
              <filename><replaceable>H</replaceable>/ghc/includes</filename>.
              Note that we are building on the host machine, using the
@@ -3757,9 +3767,9 @@ GhcStage2HcOpts = -O -fvia-C -keep-hc-files</programlisting>
            </listitem>
 
              <listitem>
-               <para>Touch <literal>config.h</literal>, just to make
+               <para>Touch <literal>ghcconfig.h</literal>, just to make
                sure it doesn't get replaced during the build:</para>
-<screen>$ touch <replaceable>H</replaceable>/ghc/includes/config.h</screen>
+<screen>$ touch <replaceable>H</replaceable>/ghc/includes/ghcconfig.h</screen>
              </listitem>
 
            <listitem>
@@ -3776,15 +3786,17 @@ $ make boot &amp;&amp; make</screen>
            </listitem>
 
            <listitem>
-<screen>$ cd <replaceable>H</replaceable>/ghc
+<screen>$ cd <replaceable>H</replaceable>/ghc/compiler
 $ make boot stage=2 &amp;&amp; make stage=2</screen>
            </listitem>
-           
+
            <listitem>
-<screen>$ cd <replaceable>H</replaceable>/ghc/utils
+<screen>$ cd <replaceable>H</replaceable>/ghc/lib
 $ make clean
-$ make -k HC=<replaceable>H</replaceable>/ghc/compiler/stage1/ghc-inplace \
-               EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files'</screen>
+$ make -k UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files'
+$ cd <replaceable>H</replaceable>/ghc/utils
+$ make clean
+$ make -k UseStage1=YES EXTRA_HC_OPTS='-O -fvia-C -keep-hc-files'</screen>
            </listitem>
            
            <listitem>
@@ -4317,6 +4329,24 @@ Cygwin programs have a more complicated mount table, and map the lettered drives
 </para>
 </sect3>
 
+<sect3><title>Crippled <command>ld</command></title>
+
+<para>
+It turns out that on both Cygwin and MSYS, the <command>ld</command> has a
+limit of 32kbytes on its command line.  Especially when using split object
+files, the make system can emit calls to <command>ld</command> with thousands
+of files on it.  Then you may see something like this:
+<programlisting>
+(cd Graphics/Rendering/OpenGL/GL/QueryUtils_split &amp;&amp; /mingw/bin/ld -r -x -o ../QueryUtils.o *.o)
+/bin/sh: /mingw/bin/ld: Invalid argument
+</programlisting>
+The solution is either to switch off object file splitting (set
+<option>SplitObjs</option> to <literal>NO</literal> in your
+<filename>build.mk</filename>),
+or to make the module smaller.
+</para>
+</sect3>
+
 <sect3><title>Host System vs Target System</title>
 
 <para>
@@ -4424,7 +4454,11 @@ Run both executables (in the order given above) to install them.  I put them in
 <listitem><para>
 Set the following environment variables
 <itemizedlist>
-  <listitem><para><literal>PATH</literal>: add <literal>c:/msys/1.0/bin</literal> to your path.  (Of course, the version number may differ.)
+   <listitem><para><literal>PATH</literal>: add <literal>c:/msys/1.0/bin</literal> and 
+                   <literal>c:/msys/1.0/local/bin</literal>
+                   to your path.  (Of course, the version number may differ.)
+                   MSYS mounts the former as both <literal>/bin</literal> and 
+                   <literal>/usr/bin</literal> and the latter as <literal>/usr/local/bin</literal>.
   </para></listitem>
 
   <listitem><para><literal>HOME</literal>: set to your home directory (e.g. <literal>c:/userid</literal>).
@@ -4695,7 +4729,7 @@ Make sure the installation directory is in your
 </listitem>
 
          <listitem>
-           <para>Install Alex.  This can be done by building from the
+           <para>Install an executable Alex.  This can be done by building from the
            source distribution in the same way as Happy.  Sources are
            available from <ulink
            url="http://www.haskell.org/alex">http://www.haskell.org/alex</ulink>.</para>
@@ -4708,7 +4742,13 @@ Just pick up a mingw bundle at
 <ulink url="http://www.mingw.org/">http://www.mingw.org/</ulink>.
 We install it in <filename>c:/mingw</filename>.
 </para>
-<para>Do <emphasis>not</emphasis> add any of the <emphasis>mingw</emphasis> binaries to your  path.
+
+<para><emphasis>On MSYS</emphasis>, add <literal>c:/mingw/bin</literal> to your PATH. MSYS does not provide <command>gcc</command>,
+<command>ld</command>, <command>ar</command>, and so on, because it just uses the MinGW ones.  So you need them
+in your path.
+</para>
+
+<para><emphasis>On Cygwin, do not</emphasis> add any of the <emphasis>mingw</emphasis> binaries to your  path.
 They are only going to get used by explicit access (via the --with-gcc flag you
 give to <command>configure</command> later).  If you do add them to your path
 you are likely to get into a mess because their names overlap with Cygwin binaries.