Skip to content

Installation

Dextool is a framework for writing plugins using libclang. The main focus is tools for testing and static analysis.

Dependencies

To build and run dextool, you will need the following packages:

Most of them can be installed using your package manager.

About D Compiler

Only ldc is able to build a release build of dextool. dmd is for debug build. Which mean that for a normal user it is ldc that you should use. Unlike the original document, this document does not mention anything about dmd.

Install Dextool on Ubuntu

(Optional) Step 1: Update and install the latest packages:

sudo apt-get update
sudo apt-get upgrade

(Optional) Step 2: Check which llvm, clang and libclang version to use.

Not required for latest version operating systems

If you are using the latest version and an updated operating system, you can skip this step, the updated document will ensure that you always install the latest version you can download. If for some reason you cannot access the required versions of the dependencies in the document, this step will be useful for you.

Run the following to check which versions are available:

apt search llvm-
apt search clang-
apt search libclang-
You should see for example libclang-14-dev.

Step 3: Install the dependencies:

sudo apt install build-essential cmake llvm-14 llvm-14-dev clang-14 libclang-14-dev libsqlite3-dev

Step 4: Install the D compiler:

The supported compiler versions are found at:

You can install them via the install script at dlang.org.

In the example below replace the compiler version with one of the supported. The version that is written below should only be seen as an example.

Example:

mkdir -p ~/dlang
wget https://dlang.org/install.sh -O ~/dlang/install.sh
sudo chmod +777 ~/dlang/install.sh
~/dlang/install.sh install ldc-1.30.0

Add the compilers to your $PATH variable:

source ~/dlang/ldc-1.30.0/activate

Step 5: Build and Install

About Ram Usage

To build dextool comfortably you need ~16Gbyte of RAM. Compiling dextool-mutate.o consume ~9Gbyte. You probably ran out of memory when compiling dextool-mutate.o. Run cmake with -DLOW_MEM=ON and single threaded.

apt-get install -y git # if you have not git installed
source ~/dlang/ldc-1.30.0/activate # enable env again
git clone https://github.com/joakim-brannstrom/dextool.git --single-branch
mkdir dextool/build
cd dextool/build
# if you have less than 16 gb memory (see note)
# cmake -DCMAKE_INSTALL_PREFIX=/usr -DLOW_MEM=ON .. (memory friend but slow)
cmake -DCMAKE_INSTALL_PREFIX=/usr .. 
make install

Step 6: Check Dextool Command

dextool --version
dextool --plugin-list

Done! Have fun.