Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login
Version 15 (modified by wilsonk, 13 years ago)
--

Building LDC for Solaris

To build LDC on Solaris is a bit tricky due to some problems when building LLVM. There are no LLVM packages for Solaris yet.

  • Get and unpack the custom GCC (for building LLVM on x86/AMD64)
    su root
    wget http://pkg.auroraux.org/GCC/gcc4.tar.7z
    7z x gcc4.tar.7z
    tar -xvf gcc4.tar
    

(All files will be unpacked to /opt/gcc4/)

  • Compile and install LLVM.
    wget http://llvm.org/releases/2.8/llvm-2.8.tar.gz
    gunzip llvm-2.8.tar.gz
    tar -xvf llvm-2.8.tar
    mkdir llvm-obj
    cd llvm-obj
    export PATH=/opt/gcc4/bin:$PATH
    ../llvm-2.8/configure --enable-optimized
    gmake
    gmake install
    
  • Compile and Install libconfig.
    wget http://www.hyperrealm.com/libconfig/libconfig-1.3.2.tar.gz
    tar -xvzf libconfig-1.3.2.tar.gz
    cd libconfig
    ./configure
    gmake
    gmake install
    
  • Compile LDC.
    hg clone http://hg.dsource.org/projects/ldc ldc
    cd ldc
    ccmake ./
    gmake
    

Note: In ccmake, press 'c' and then 'g'.


Here is an example ldc.conf for use with Tango: (import/ contains tango/ and object.di, lib/ contains libtango.a)

default:
{
    switches = [
        "-I%%ldcbinarypath%%/../import",
        "-I%%ldcbinarypath%%/../import/tango/core/vendor",
        "-L-L%%ldcbinarypath%%/../lib",
        "-d-version=Tango",
        "-defaultlib=tango",
        "-debuglib=tango"
    ];
};

The mandatory "Hello World":

import tango.io.Stdout;

void main()
{
   Stdout("Hello World.").newline;
}
ldc main.d
./main
Copyright © 2008, LDC Development Team.