Including kodo-rlnc in Your Application

The following sections describe how you can include kodo-rlnc in your application/project.

Using waf as a Build System

The easiest option is to use the waf build system and our tools to define kodo-rlnc as a dependency for your standalone project. The Hello Kodo section provides a great starting point that can be extended to meet your specific requirements. It is easy to learn the basic features of waf from the official documentation or from our simple examples.

Using Another Build System

If you cannot use waf for some reason, then it is also possible to compile kodo-rlnc with another build system. Of course, this requires more manual configuration.

Note that kodo-rlnc contains a static library and some header-only components. Moreover, it also requires some dependencies that are compiled as static libraries. This means that both kodo-rlnc and its dependencies should be included when you build a custom application.

The following sections explain how you can do this manually with g++, you can adapt these commands to your custom build system.

Installing the Kodo Headers and Libraries

  1. As a starting point, we assume that you completed the kodo-rlnc Quick Start section and you can successfully execute our unit tests with this command:

    python waf --run_tests
    
  2. The following command will copy the static libraries to the kodo_build folder (these static libraries should be added to your application):

    python waf install --install_path=kodo_build --install_static_libs --install_relative
    

    This command also installs the necessary header files in the include subfolder inside the specified install_path. These header files are fully sufficient to use the standard coders in kodo-rlnc, but you will need some extra headers if you want to compile the object and file coders.

Compiling a Basic Example

  1. Here we show the command to manually compile a basic example in kodo-rlnc (you can use your own application instead). Change the directory to the decode_encode_simple example:

    cd examples/encode_decode_simple
    
  2. Compile the example using the following command:

    g++ \
    -O2 \
    -ftree-vectorize \
    -std=c++14 \
    -I../../kodo_build/include \
    encode_decode_simple.cpp \
    -o encode_decode_simple \
    -Wl,-Bstatic \
    -L../../kodo_build \
    -lkodo_rlnc \
    -lfifi \
    -lcpuid \
    -Wl,-Bdynamic
    

    This command is only provided to facilitate the integration with your build system or IDE. It is not recommended to build your software manually with a command like this.

    Warning

    This command only contains the basic optimization flags, and you might need to add more flags to get optimal performance.

  3. Run the compiled example application:

    ./encode_decode_simple
    

Compiling an Advanced Example

  1. Some advanced examples also include header-only components from other libraries, so the common include folder is not sufficient for these. Here we show a more complex solution to manually compile the encode_decode_file example (that uses the file coders):

    cd examples/encode_decode_file
    
  2. This command specifies additional include paths and static libraries that are necessary to use the file coders:

    g++ \
    -O2 \
    -ftree-vectorize \
    -std=c++14 \
    -I../../kodo_build/include \
    -I../../resolve_symlinks/boost \
    -I../../resolve_symlinks/kodo-core/src \
    -I../../resolve_symlinks/endian/src \
    encode_decode_file.cpp \
    -o encode_decode_file \
    -Wl,-Bstatic \
    -L../../kodo_build \
    -lkodo_rlnc \
    -lfifi \
    -lcpuid \
    -lboost_iostreams \
    -Wl,-Bdynamic
    

    Warning

    The relative include paths presented here are going to change according to the location of your application. It is recommended to use absolute paths or environment variables in your build system. Furthermore, you might need to add more include paths and libraries depending on the actual program that you want to compile.

  3. Run the compiled example:

    ./encode_decode_file