gdc / d / INSTALL.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

  <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

  <title>Build Instructions</title>


<h2>Build Instructions</h2>

<h3>Required source packages</h3>

  <li>The "core" package of a recent GCC 3.4.x, 4.0.x, 4.1.x, 4.2.x, 4.3.x or 4.4.x
  <li>The GDC source package<span style="font-weight: bold;">.</span></li>

<h3>Required software</h3>

  <li>The usual <a href="">GCC
  <li>An existing C++ compiler (even if you use <span style="font-family: monospace;">make bootstrap</span>).&nbsp; G++ 3.x,
4.0.1, and later versions
are known to work.&nbsp; G++ 2.x and 4.0.0 are
known to <span style="font-style: italic;">not </span>work.</li>

For runtime software requirements, see the <a href="manual.html">user manual</a>.


  <li><span style="font-style: italic; font-family: monospace;">&lt;srcdir&gt;</span>
-- Location of the GCC sources</li>
  <li><span style="font-style: italic; font-family: monospace;">&lt;builddir&gt;</span>
-- Build directory for GCC</li>
  <li><span style="font-style: italic; font-family: monospace;">&lt;prefix&gt;</span>
-- Install directory for GCC</li>

<h3>Building the Compiler and Runtime Library<br>

  <li>Unpack the GCC archive.&nbsp; This creates <span style="font-family: monospace;">&lt;</span><span style="font-style: italic; font-family: monospace;">srcdir</span><span style="font-family: monospace;">&gt;</span>.<br>
  <li>Change to the <span style="font-style: italic; font-family: monospace;">&lt;srcdir&gt;</span><span style="font-family: monospace;">/gcc</span> directory.</li>
  <li>Unpack the gdc archive.&nbsp; This will create a
subdirectory named "<span style="font-family: monospace;">d</span>".</li>
  <li>Change back to <span style="font-style: italic; font-family: monospace;">&lt;srcdir&gt;</span><span style="font-family: monospace;"></span> and run the setup script:<br>
    <span style="font-family: monospace;">./gcc/d/</span><br>

      If the source was obtained from Mercurial, use
      <span style="font-family: monospace;">--d-language-version</span>
	to specify which version of the D language to use:<br>
    <span style="font-family: monospace;">./gcc/d/ --d-language-version=2</span><br>
      Note that this creates a file in the <span style="font-family: monospace;">d/</span> source directory.    <br>
  <li>Build GCC using the normal <a href="">install
instructions</a>.&nbsp; The
only difference is that "<span style="font-family: monospace;">d</span>"
is added to the <span style="font-family: monospace;">--enable-languages</span>

If you need to specify a compiler
to build GCC<span style="font-style: italic;"> </span>other than the
system's default, change the <span style="font-family: monospace;">PATH</span>,
or use the "<span style="font-family: monospace;">CC</span>"
and "<span style="font-family: monospace;">CXX</span>" environment
variables. Example:<br>


    <span style="font-family: monospace;">CC=gcc3 CXX=g++3 &lt;<span style="font-style: italic;">srcdir</span>&gt;/configure
--prefix=/usr/local/gcc-3.4 --enable-languages=c,d,c++</span><br>


Remember to always use "<span style="font-family: monospace;">gmake</span>"
if GNU Make is not the system's default.<span style="font-style: italic;"></span>&nbsp;<br>

  <li>Install with "<span style="font-family: monospace;">make
install</span>". (Depending on your distribution, you may need to use "sudo make install" instead of just "make install".)<br>


<h3>Building a Cross Compiler</h3>

(This section is not complete)<br>


Building a cross compiler takes some extra effort now (except for
MinGW.)&nbsp; It will become more automated as people contribute
information for various targets.<br>


You will need to create two files (three for a unix target) that are
normally generated during a native build.&nbsp; The files are frag-gen,
frag-math, and (for unix) frag-unix.&nbsp; Here are some ways to create
the files:<br>


  <li>Do a native build on the target.&nbsp; The files will
be in <span style="font-style: italic; font-family: monospace;">&lt;builddir&gt;/&lt;target&gt;/libphobos</span>.<br>
  <li>Look at the existing files in <span style="font-style: italic; font-family: monospace;">&lt;srcdir&gt;</span><span style="font-family: monospace;">/gcc/d/phobos/config/mingw</span> as
an example of what is need.<br>
  <li>Let the build fail for Phobos.&nbsp; You will have a working C
cross-compiler at that point. Compile gen_config1.c,
gen_math.c, gen_unix.c, run them on the target, and copy the resultant
files back
to your build system.</li>


Once you have the files, put them in a directory and configure with the
option --enable-phobos-config-dir=&lt;dir&gt;.<br>


<h3>Runtime Library Notes<br>


  <li>To run the unit tests, run "<span style="font-family: monospace;">make
    <li>On some targets, std.math tests will fail because there
is no 80-bit real (or library support for it.)</li>
    <li>On some targets, std.conv tests will fail because the floating
point conversion functions do not work as expected.<br>

    <li>On FreeBSD and Linux, the test of the "%A" format will fail due
to a library bug.<br>