How to install LibCSP

CSP supports three build systems:

Using Meson

In order to compile CSP with meson, you run the following commands:

meson setup builddir
cd builddir

You can use meson configure to change the core options as well as compiler or project options.

Using Waf

In order to compile CSP with waf, you first need to configure the toolchain, what operating system to compile for, the location of required libraries and whether to enable certain optional features.

To configure CSP to build with the AVR32 toolchain for FreeRTOS and output the compiled libcsp.a and header files to the install directory, issue:

./waf configure --toolchain=avr32- --with-os=freertos --prefix=install

When compiling for FreeRTOS, the path to the FreeRTOS header files must be specified with --includes=PATH.

A number of optional features can be enabled by from the configure script. ./waf configure --help to list the available configure options.

The CAN driver (based on socketcan) can be enabled by appending the configure option --enable-can-socketcan.

To build and copy the library to the location specified with –prefix, use:

./waf build install

Using CMake

In order to compile CSP with cmake, you run the following commands:

cmake -GNinja -B builddir
cd builddir

To install the compiled and header files to the install directory, you run the following command:

ninja install

By default, it will be installed in /usr/local/lib and /usr/local/include, but if you wish to change it, you can specify -DCMAKE_INSTALL_PREFIX=<path> during the build process, and it will be installed in <path>/lib and <path>/include.

To install only the runtime library, use the following command:

cmake --install builddir --component runtime

Reproducible Builds

libcsp supports Reproducible Builds. To enable it, set CSP_REPRODUCIBLE_BUILDS to 1.

Please note that, when reproducible builds are enabled, CSP_CMP_IDENT does not return the compilation date and time.

When reproducible builds are enabled, both the BuildID and hash values of generated binaries remain consistent for each build. Our reproducible builds also support building in different directories. Thus, different users should generate precisely the same binaries, given the same source code and build environment.

You can learn more about reproducible builds at

Use the following commands for each build system:


./waf configure --enable-reproducible-builds


meson setup builddir . -Denable_reproducible_builds=true


cmake -GNinja -B builddir -DCSP_REPRODUCIBLE_BUILDS=ON

Note: By default, CMake embeds the build directory in the binaries, resulting in non-deterministic builds. To address this, use CMAKE_BUILD_RPATH_USE_ORIGIN=ON or CMAKE_SKIP_RPATH=ON as follows:


See Reproducible Builds site or CMake document for more details.