Building kcov From Source


As of this writing, the recommended way to get kcov is to build from upstream sources from GitHub. Ubuntu Xenial (for example) has packaged versions, but they have known problems not evident when using upstream.

Install the build dependencies:

sudo apt install binutils-dev libdw-dev libelf-dev libiberty-dev

To build from source, follow these steps:

git clone
cd kcov
mkdir build
cd build
cmake ..
cmake --build .

The resulting binary will be in kcov/build/src/kcov. Create a symbolic link to the binary from some directory on your $PATH.


A recent version of kcov is installed by the script.

Be sure that your account has developer mode enabled, which gives you the privileges necessary to run debuggers and similar tools. If you are an administrator, use this command:

sudo /usr/sbin/DevToolsSecurity --enable