Building lldb

Trying to build the latest lldb.

A good introduction about lldb is this presentation at the Apple developper conference [1]. For something more focused on ARM, see [2], and for something more focused on FreeBSD, see [3] and [4].

Building from svn

The official build guide is [5]. There are git mirrors of each svn repository.

Get the sources:

svn co llvm
cd llvm/tools
svn co clang
svn co lldb


apt install cmake g++ swig python2.7-dev libedit-dev libncurses5-dev


mkdir build
cd build
cmake ../llvm
make lldb


(lldb) version
lldb version 7.0.0 ( revision )

Cannot do anything with 8GB nowadays!

Linking is very pretty memory-consuming. 8GB is not enough:

[ 98%] Linking CXX shared library ../../../../lib/
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
tools/lldb/source/API/CMakeFiles/liblldb.dir/build.make:2165: recipe for target 'lib/' failed

The linker was killed because both RAM and swap were full!

Create a additional temporary swap from file:

fallocate -l 512M /swapfile2
chmod 600 /swapfile2
mkswap /swapfile2
swapon /swapfile2

Building on scaleway ARM64

The version of swig provided by Ubuntu 16.04 and Debian Stretch is too old. Use Ubuntu 18.04 via docker. For installing docker on Ubuntu for ARM64, see [6].

docker run --rm -ti -v /home/vjp/lldb/:/root arm64v8/ubuntu:18.04