dextool 3.3.0

C/C++ tooling for mocking, mutation testing and visualisation

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

dextool Build Status

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

The plugins in a standard installation of Dextool are:

  • Analyze. Analyze C/C++ code to generate complexity numbers such as McCabe.
  • C TestDouble. Analyze C code to generate a test double implementation.
  • C++ TestDouble. Analyze C++ code to generate a test double implementation.
  • Mutate. Mutation testing tool for C/C++.
  • UML. Analyze C/C++ code to generate PlantUML diagrams.

Plugin Status

  • Analyze: production ready.
  • C TestDouble: production ready. The API of the generated code and how it behaves is stable.
  • C++ TestDouble: production ready. The API of the generated code and how it behaves is stable.
  • Mutate: production ready.
  • Fuzzer: alpha.
  • UML: beta.



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

  • llvm >= 4.0
  • llvm-xyz-dev >= 4.0
  • libclang-xyz-dev >= 4.0
  • cmake >= 3.5
  • sqlite3 >= 3.24.0
  • D compiler (dmd >= 2.094.2 or ldc >= 1.24.0)

Most of them can be installed using your package manager.

Installation instructions for Ubuntu is available in the doc/install directory.

Build and Install

The easiest way to build and run dextool is to do it via dub.

dub run dextool -- -h

But if you want to, these are the steps to build it using CMake:

git clone
cd dextool
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/path/to/where/to/install/dextool/binaries ..
make install

Done! Have fun. Don't be shy to report any issue that you find.

Common Build Errors

component_tests Fail

The most common reason for why component_tests fail is that clang++ try to use the latest GCC that is installed, but the c++ standard library is not installed for that compiler.

Try to compile the following code with clang++:

#include <string>

int main(int argc, char **argv) {
    return 0;
clang++ -v test.cpp

If it fails with something like this:

test.cpp:1:10: fatal error: 'string' file not found

it means that you need to install the c++ standard library for your compiler.

In the output look for this line:


From that line we can deduce that the package to install in Ubuntu is:

sudo apt install libstdc++-XYZ-dev
Mismatch Clang and LLVM

To build dextool, the dev packages are required. Dextool is optimistic and assume that the latest and greatest version of llvm+libclang should be used. But this also requires that the dev packages are installed.

If you get this error:

libclang_interop.hpp:13:10: fatal error: clang/Analysis/CFG.h: No such file or directory
 #include <clang/Analysis/CFG.h>

It means that you need to install llvm-x.y-dev and libclang-x.y-dev for the version that Dextool detected.

The sqlite3 library source code with a CMake build file in the vendor's directory. It is intended for those old OSs that have too old versions of SQLite.

To use it do something like this.

mkdir sqlite3
cd sqlite3 && cmake ../vendor/sqlite && make && cd ..
# setup dextool build to use it
mkdir build
cd build && cmake .. -DSQLITE3_LIB="-L/opt/sqlite -lsqlite3"
Cmake is unable to find the D compiler

If you have a D compiler installed in such a way that it isn't available in your $PATH you can specify it manually.

cmake .. -DD_COMPILER=/foo/bar/dmd/2.088/linux64/bin/dmd


See the usage examples in respective plugin directory.


Jacob Carlborg for his excellent DStep. It was used as a huge inspiration for this code base. Without DStep, Dextool wouldn't exist.

  • Joakim Brännström
System dependencies:
for ubuntu: sudo apt install build-essential cmake llvm-4.0 llvm-4.0-dev clang-4.0 libclang-4.0-dev libsqlite3-dev
3.3.0 2021-Jun-08
3.2.0 2021-May-16
3.1.0 2021-May-10
3.0.0 2021-Jan-27
2.3.0 2020-Sep-01
Show all 48 versions
Download Stats:
  • 4 downloads today

  • 4 downloads this week

  • 7 downloads this month

  • 114 downloads total

Short URL: