Build Instructions

Required source packages

Required software

Directories

Building the Compiler

  1. Unpack the GCC archive.  This creates <srcdir>.
  2. Change the the <srcdir>/gcc directory.
  3. Unpack the DMD-GCC glue archive.  This will create a subdirectory named "d".
  4. In the "d" subdirectory, find the GCC patch closest to your version of GCC.  These are all named patch-gcc-....
  5. From <srcdir>/gcc, apply the patch. Example:

    patch -p1 < d/patch-gcc-3.4.x

  6. Build GCC using the normal install instructions.  The only difference is that "d" is added to the --enable-languages option.  Unless you will not be using the recls package, you also need to enable the C++ compiler. 

    If you need to specify a compiler to build GCC other than the system's default, 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.

    IMPORTANT: If you are updating from an earlier version of GDC without doing a fresh build, delete all object files in <builddir>/gcc/d before building.

  7. Install normally with "make install". 

Runtime Library

Phobos does not build automatically nor is it integrated with the GCC target library system.
  1. (For Cygwin only)  Change to <srcdir>/gcc/d/phobos/ and run prepcygwin.sh.
  2. Choose a build directory for Phobos (e.g., <builddir>/phobos), create it, and change to it.  If you are updating from an earlier version of GDC, completely remove the old Phobos build directory.
  3. Make sure the newly-installed compiler is in your path.  Add to the front of the path so that the gcc and g++ that were just built will be used.
  4. Run <srcdir>/gcc/d/phobos/configure.  Use the same --prefix argument that you passed to the GCC configure.  You can set the environment variable "DFLAGS".  Example:

    DFLAGS="-O2 -g -frelease" <srcdr>/gcc/d/phobos/configure --prefix=/usr/local/gcc-3.4

    Use --enable-thread-lib=<arg> to specify the linker arguments needed to enable threads.  The configure script can usually determine this automatically. 
  5. Run make and then make install.

Notes