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

Build Instructions using Tango 0.99.9

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

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

Compile ldc and the runtime and include ldc in your path

cd ldc
make
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:

You should probably use the new Tango build tool called bob (unless there is no prebuilt bob binary for your architecture ... then you should try bob.rb with ruby, then try the build script). I have tested Tango-0.99.9 and this should build on linux just fine without any patches ... hopefully :) Of course, you can change the -o="..." options to whatever you like. Make sure to use your architectures binary in the below command (ie. replace the linux64 part).

cd ../tango
./build/bin/linux64/bob -vu -r=ldc -c=ldc -o="-O3 -release" -l=../ldc/lib/libtango -p=linux .

If you end up needing 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 include -L-ltango'.
Here is an example:

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

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.