Build Instructions
Required source packages
- The "core" package of a recent GCC 3.4.x, 4.0.x, or 4.1.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 software requirements, see the user manual.
Directories
- <srcdir>
-- Location of the GCC sources
- <builddir>
-- Build directory for GCC
- <prefix>
-- Install directory for GCC
Building the Compiler and Runtime Library
- Unpack the GCC archive. This creates <srcdir>.
- Change to the <srcdir>/gcc directory.
- Unpack the gdc archive. This will create a
subdirectory named "d".
- Change back to <srcdir> and run the setup script:
./gcc/d/setup-gcc.sh
- 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.
- Install with "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 files:
- Do a native build on the target. The files will
be in <builddir>/<target>/libphobos.
- Look at the existing files in <srcdir>/gcc/d/phobos/config/mingw as
an example of what is need.
- Let the build fail for Phobos. 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.
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".
- On some targets, std.math tests will fail because
there
is no 80-bit real (or library support for it.)
- On some targets, std.conv tests will fail because the floating
point conversion functions do not work as expected.
- On FreeBSD and Linux, the test of the "%A" format will fail due
to a library bug.