gdc / d / INSTALL

Full commit
Build Instructions

Required source packages

    * 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 release.
    * The GDC source package.
Required software

    * The usual GCC requirements (
    * An existing C++ compiler (even if you use "make bootstrap").  G++
      3.x, 4.0.1, and later versions are known to work.  G++ 2.x and
      4.0.0 are known to not work.

    For runtime requirements, see the README document.


    * <srcdir> -- Location of the GCC sources
    * <builddir> -- Build directory for GCC
    * <prefix> -- Install directory for GCC

Building the Compiler and Runtime Library

   1. Unpack the GCC archive.  This creates <srcdir>.
   2. Change the the <srcdir>/gcc directory.
   3. Unpack the GDC archive.  This will create a subdirectory named "d".
   4. Change back to <srcdir> and run the setup script:


      If the source was obtained from Subversion, use
      --d-language-version to specify which version of the D language
      to use:

      ./gcc/d/ --d-language-version=2

      Note that this creates a file in the d/ source directory.

   5. Build GCC using the normal install instructions.  The only difference is
      that "d" is added to the --enable-languages option.

      If you need to specify a compiler to build GCC other than the
      system's default, change the PATH, or use the "CC" and "CXX"
      environment variables. Example:

      CC=gcc3 CXX=g++3 <srcdir>/configure --prefix=/usr/local/gcc-3.4 --enable-languages=c,d,c++

      Remember to always use "gmake" if GNU Make is not the system's default.

   6. Install with "make install". (Depending on your distribution, you may need
   to use "sudo make install" instead of just "make install".)

Building a Cross Compiler

(This section is not complete)

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

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

    * Do a native build and see what is required.  The files will be
      in <builddir>/<target>/libphobos.
    * Look at the existing files in
    * Once you have a C cross-compiler, just compile gen_config1.c,
      gen_math.c, gen_unix.c, run them on the target, and copy the
      files back to your build system.

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

Runtime Library Notes

    * To run the unit tests, run "make check-target-libphobos".
          o On some targets, std.math tests will fail because there is
            no 80-bit real (or library support for it.)
          o On some targets, std.conv tests will fail because the
            floating point conversion functions do not work as
          o On FreeBSD and Linux, the test of the "%A" format will fail due
            to a library bug.