Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Build Instructions using Tango 0.99.8

Fetch the tango runtime for D1. Note that LDC fails to compile trunk at the moment - use 0.99.8. As of revision 1367 (dmdfe 1.045 merge), you will need to apply the patch in tango-0.99.8.patch.

cd ..
svn co http://svn.dsource.org/projects/tango/tags/releases/0.99.8 tango
patch -p0  -d tango/ < ldc/tango-0.99.8.patch

Compile ldc and the runtime and include ldc in your path

cd ldc
make runtime
export PATH=`pwd`/bin:${PATH}

Using Tango

While LDC does use the Tango runtime per default, you still need to compile the Tango user library to build most applications.

Build the Tango user library:

Use the build.sh script then use the following few instructions:

cd ../tango/lib/
chmod a+x build-tango.sh
./build-tango.sh ldc
cp libtango-user-ldc.a ../../ldc/lib/

Now adjust your ldc/bin/ldc.conf to to something like this, if ldc fails to build a sample program with undefined references. Here is an example:

default:
{
    switches = [
        "-I/home/someUserName/tango",
        "-I/home/someUserName/tango/user",
        "-I/home/someUserName/tango/lib/common",
        "-I/home/someUserName/tango/tango/core/vendor",
        "-L-L%%ldcbinarypath%%/../lib",
        "-L-ltango-user-ldc",
        "-d-version=Tango",
        "-defaultlib=tango-base-ldc",
        "-debuglib=tango-base-ldc"
    ];
};

For Mac OS X Tiger 10.4, you should also add the following to DFLAGS in ldc/bin/ldc.conf (not needed for Leopard):

-L-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -defaultlib=gcc_eh

If you need to import a module from tango.core and it does not exist, see if it exists in tango/lib/common/tango/core/. If so, run ldc -H -o- on those modules, then copy the resulting .di files to the appropriate directory. Only copy the .di files, not the .d files; the .d files contain implementations that may not be correct for LDC, and LDC might attempt to inline these wrong implementations. (Or your build tool might try to compile and use the .d files, which would be equally wrong.)

Alternatively you can use Rebuild ...

Using Rebuild

Rebuild has some advantages to using a static Tango library (as described above). It compiles and links only to the modules you actually need, and changing the compiler options, for all the modules your application needs, is easy.

If you want to use DSSS or Rebuild with LDC, install the ldc-posix-tango Rebuild profile from the root dir:

mkdir -p $HOME/.rebuild
ln -s `pwd`/ldc-posix-tango $HOME/.rebuild

After you made sure that LDC is in PATH, you can use Rebuild from anywhere.

export PATH=$PATH:`pwd`/bin
rebuild -dc=ldc-posix-tango test.d
Copyright © 2008, LDC Development Team.