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

Building LDC 0.9.2 on OS X (Snow Leopard)

This guide assumes that you already have libconfig (available as libconfig-hr on MacPorts and cmake installed and that you have a 64bit system. Additionally, your system should have Mercurial. Xcode may be required in order to build LLVM.

First we need to get LLVM:

curl -O http://llvm.org/releases/2.8/llvm-2.8.tar.gz
tar -xvzf llvm-2.8.tar.gz
mkdir llvm-obj
cd llvm-obj

Set the following Environment Variables:

TARGETOPTIONS='--with-arch=pentium-m --with-tune=prescott --disable-multilib'
TRIPLE=x86_64-apple-darwin10

Execute the following to build and install LLVM and prepare LDC:

../llvm-2.8/configure --with-gxx-include-dir=/usr/include/c++/4.0.0 --build=$TRIPLE --host=$TRIPLE --target=$TRIPLE --enable-optimized
make
sudo make install
cd ..

hg clone -r 0.9.2 http://hg.dsource.org/projects/ldc ldc
cd ldc
ccmake ./

In ccmake set the following:

  • If you have libconfig installed in /usr/local/lib, you also need to set LIBCONFIG_LDFLAGS="-L/usr/local/lib -lconfig++" in advanced options of ccmake (while configuring, press 't', scroll down).
  • DEFAULT_TARGET should be set to x86_64-apple-darwin10.2.0

press c and then g to generate the Makefile

Now it is time to:

make
make install

After that is completed we need to get Tango. Here we are compiling from trunk because the bob binary does not exist for osx in the current release.

export PATH=`pwd`/bin:${PATH}
cd ..
svn co http://svn.dsource.org/projects/tango/trunk tango
cd tango
./build/bin/osx32/bob -vu -r=ldc -c=ldc .
cp libtango.a ../ldc/lib/libtango.a
cd ../ldc
vim bin/ldc.conf

The file should look similar to the following:

default:
{
    // 'switches' holds array of string that are appends to the command line
    // arguments before they are parsed.
    switches = [
        "-I/Users/[username]/ldc/../tango",
        "-I/Users/[username]/ldc/../tango/user",
        "-I/Users/[username]/ldc/../tango/lib/common",
        "-I/Users/[username]/ldc/../tango/tango/core/vendor",
        "-L-L%%ldcbinarypath%%/../lib",
        "-L-ltango",
        "-d-version=Tango",
        "-defaultlib=tango",
        "-debuglib=tango"
    ];
};

and finally run:

make install

Building LDC hg tip on OS X (Snow Leopard)

This guide assumes that you already have libconfig (available as libconfig-hr on MacPorts) and CMake installed and that you have a 64bit system. Additionally, your system should have Mercurial. Xcode may be required in order to build LLVM.

First, make sure you have a copy of LLVM 2.9 installed, either via a package manager, or by hand as described below:

curl -O http://llvm.org/releases/2.9/llvm-2.9.tgz
tar -xvzf llvm-2.9.tar.gz

mkdir llvm-obj; cd llvm-obj
../llvm-2.9/configure --enable-optimized
make
sudo make install

Now we can fetch, compile and install LDC:

cd ..
hg clone http://bitbucket.org/lindquist/ldc ldc
mkdir ldc-obj; cd ldc-obj
cmake ../ldc
make
sudo make install

After that is completed, we need to compile and install Tango.

cd ..
svn co http://svn.dsource.org/projects/tango/trunk tango
cd tango
build/scripts/bob.rb -r ldc -c ldc -p osx .
sudo cp libtango.a /usr/local/lib/libtango-ldc.a
sudo mkdir -p /usr/local/include/d
sudo cp -a tango /usr/local/include/d
sudo cp object.di /usr/local/include/d
cd /usr/local/include/d
sudo ln -s tango/core/vendor/ldc .

The last thing which remains is setting up the ldc.conf in /usr/local/bin. It should look like this:

default:
{
    // 'switches' holds array of string that are appends to the command line
    // arguments before they are parsed.
    switches = [
        "-I/usr/local/include/d",
        "-L-L%%ldcbinarypath%%/../lib",
        "-d-version=Tango",
        "-defaultlib=tango-ldc",
        "-debuglib=tango-ldc"
    ];
};

Plugin for Xcode 3.2.5

http://sourceforge.net/projects/ldcplugin/

By default plugin uses the library Tango. It requires the installation of the compiler in the following locations:

Compiler

/usr/local/bin/ldc

Library

/usr/local/lib

Module search path

/usr/local/include/d

ldc.conf

default:
{
    switches = [
    ];
};
Copyright © 2008, LDC Development Team.