Skip to content
redstar edited this page Sep 16, 2012 · 21 revisions

LDC Installation process

This section will explain how to install ldc on your system

Build dependencies

  • libconfig
  • libconfig-devel
  • cmake
  • gc
  • gcc-c++
  • gcc
  • llvm 3.1 or llvm 3.0

Please check the LLVM page on broken versions of GCC and other tools to make sure that you have the right tool chain.

LLVM

On linux many distribution have already packaged this one, so take it.

Manual build

Download llvm 3.1 (preferred) with $ wget http://www.llvm.org/releases/3.1/llvm-3.1.src.tar.gz or llvm 3.0 with $ wget http://www.llvm.org/releases/3.0/llvm-3.0.tar.gz

on 32 bit system

$ ./configure --prefix=/usr             \
              --bindir=/usr/bin         \
              --datadir=/usr/share      \
              --includedir=/usr/include \
              --libdir=/usr/lib         \
              --enable-optimized        \
              --enable-assertions

on 64 bit system

$ ./configure --prefix=/usr             \
              --bindir=/usr/bin         \
              --datadir=/usr/share      \
              --includedir=/usr/include \
              --libdir=/usr/lib64       \
              --enable-optimized        \
              --enable-assertions

Build llvm

make -j9

Install llvm

su -c 'make install'

LDC

Now we will build and install ldc as D2 compiler. First download ldc from the Github repository.

$ git clone git://github.com/ldc-developers/ldc.git

Get druntime and phobos2 for ldc.

$ cd ldc; git submodule update --init;

Manual build

By default build ldc as D2 compiler

In /usr/local

$ cmake .
$ make -j9 VERBOSE=2 phobos2

In /usr

$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
$ make -j9 VERBOSE=2 phobos2

In your home dir

$ cmake -DCMAKE_INSTALL_PREFIX:PATH=${HOME} .
$ make -j9 VERBOSE=2 phobos2

Useful variables

  • LIB_SUFFIX some operating systems use /usr/lib64 as lib dir for 64bits libraries like Fedora, Ubuntu ...
    In this case -DLIB_SUFFIX=64
  • CMAKE_INSTALL_PREFIX this var could be used:
  • default prefix is /usr/local
  • User install you want install in your home directory so set CHROOT_INSTALL_DIR as ${HOME}
  • BUILD_SHARED_LIBS you want build as static library turn to OFF: -DBUILD_SHARED_LIBS=OFF
  • INCLUDE_INSTALL_DIR if you want install header file in other directory as default
  • D_VERSION this var equal 2 by default set this one to 1 if you want build ldc as D1 compiler
  • PHOBOS2_DIR if you have put the phobos dir in other way set path to right dir
  • RUNTIME_DIR
  • if you have put the runtime dir in other way set path to right dir (D2 => druntime)
  • if you build as D1 compiler and use ccmake set this var to runtime dir

Install ldc

$ su -c 'make install'

Tips

Sometime you have a build's computer and an other computer to install. So on on your build's computer by example you mount in /mnt the root dir of install computer. In this cas set DESTDIR as /mnt.

$ su -c 'make install DESTDIR=/mnt'

Clone this wiki locally