Building the Intel(R) Processor Trace (Intel PT) Decoder Library and Samples

This chapter gives step-by-step instructions for building the library and the sample tools using cmake. For detailed information on cmake, see


Besides the standard cmake options of build type and install directory, you will find project-specific options for enabling optional features, optional components, or optional build variants.

Optional Components

By default, only the decoder library is built. Other components can be enabled by setting the respective cmake variable to ON.

The following optional components are availble:

PTUNIT             A simple unit test framework.
                   A collection of unit tests for libipt.

PTDUMP             A packet dumper example.

PTXED              A trace disassembler example.

PTTC               A trace test generator.

SIDEBAND           A sideband correlation library

PEVENT             Support for the Linux perf_event sideband format.

                   This feature requires the linux/perf_event.h header.

Optional Features

Features are enabled by setting the respective FEATURE_ cmake variable. This causes the FEATURE_ pre-processor macro to be defined and may also cause additional source files to be compiled and additional libraries to be linked.

Features are enabled globally and will be used by all components that support the feature. The following features are supported:

FEATURE_ELF         Support for the ELF object format.

                    This feature requires the elf.h header.

FEATURE_THREADS     Support some amount of multi-threading.

                    This feature makes image functions thread-safe.

Build Variants

Some build variants depend on libraries or header files that may not be available on all supported platforms.

GCOV                Support for code coverage using libgcov.

                    This build variant requires libgcov and is not availble
                    on Windows.

DEVBUILD            Enable compiler warnings and turn them into errors.

Version Settings

The major, minor, and patch version numbers are set in the sources and must be changed there. You can set the optional build number and an arbitrary extension string.

PT_VERSION_BUILD    The optional build number.

                    Defaults to zero (no build number).

PT_VERSION_EXT      An arbitrary version extension string.

                    Defaults to the empty string (no extension string).


In order to build ptxed, the location of the XED library and the XED header files must be specified.

XED_INCLUDE         Path to the directory containing the XED header files.

XED_LIBDIR          Path to the directory containing the XED library.

When using XED from a PIN distribution, the respective directories are located in extras/xed2-<arch>/.

When using XED from github, the respective directories are located in the install directory (default: kits/xed-install-date-os-cpu) and the header files are located in include/xed. Please refer to the README in the XED tree on how to build XED.

Building on Linux* and OS X*

We recommend out-of-tree builds. Start by creating the destination directory and navigating into it:

$ mkdir -p /path/to/dest
$ cd /path/to/dest

From here, call cmake with the top-level source directory as argument. You may already pass some or all of the cmake variables as arguments to cmake. Without arguments, cmake uses default values.

$ cmake /path/to/src

If you have not passed values for XED_INCLUDE or XED_LIBDIR, you need to configure them now if you want to build ptxed. You may also use this command to change the configuration at any time later on.

$ make edit_cache

After configuring the cmake cache, you can build either specific targets or everything using one of:

$ make <target>
$ make

Use the help make target to learn about available make targets:

$ make help

Building on Windows*

We recommend using the cmake GUI. After starting the cmake GUI, fill in the following fields:

Where is the source code:       Path to the top-level source directory.

Where to build the binaries:    Path to the destination directory.

We recommend out-of-tree builds, so the build directory should not be the same as or below the source directory. After this first configuration step, press the


button and select the builder you want to use.

Cmake will now populate the remainder of the window with configuration options. Please make sure to specify at least XED_INCLUDE and XED_LIBDIR if you want to build ptxed. After completing the configuration, press the


button. If you selected a Visual Studio generator in the first step, cmake will now generate a Visual Studio solution. You can repeat this step if you want to change the configuration later on. Beware that you always need to press the Generate button after changing the configuration.

In the case of a Visual Studio generator, you may now open the generated Visual Studio solution and build the library and samples.