Wiki

Clone wiki

gdc / MinGWCrossCompile

Building an Ubuntu hosted, Win32 target, GDC cross compiler

Prerequisites

Ubuntu provides a cross compiler for C/C++ through the repository, so to save the time to build your toolchain, this guide assumes you'll be using the packages provided.

  • gcc-mingw32

Obtain the GCC compiler source from one of the mirror sites

Download the latest gdc trunk.

hg clone http://bitbucket.org/goshawk/gdc/

Create a separate directory for building and installing

mkdir -p buildgw

Compiling

Extract the gcc tarball and configure D

tar -xzf gcc-core-4.5.2.tar.bz2
cd gcc-4.5.2/gcc

ln -s ../../d d
cd ../

# Version 1 is the default, for Version 2 need to explicitly specify it.
./gcc/d/setup-gcc.sh -v2

If everything goes ok setting up GDC then it's time to configure and build.

cd ../buildgw

../gcc-4.5.2/configure --prefix=/usr \
    --libexecdir=/usr/lib/gcc-mingw32 \
    --target=i586-mingw32msvc \
    --enable-languages=d \
    --enable-threads \
    --enable-sjlj-exceptions \
    --disable-multilib \
    --disable-shared \
    --enable-version-specific-runtime-libs \
    --with-pkgversion="GDC 477:978bb5bc82cf  DMD 2.052" \
    --with-bugurl="http://bitbucket.org/goshawk/gdc/issues"

make -j3

Used GCC options:

  • --prefix : Where GDC installs to. GCC will also use this path to search for mingw headers during build too.
  • --enable-languages : Which languages to enable.
  • --enable-threads :
  • --enable-sjlj-exceptions :
  • --disable-multilib :
  • --disable-shared :
  • --enable-version-specific-runtime-libs :
  • --with-bugurl : Who to send bugs to.
  • --with-pkgversion : Version string, I like to include GDC revision and DMD version.

Updated