Compiling kRPC

Getting the source code

First you need to download a copy of the source code, which is available from GitHub or using the following on the command line:

git clone

Install Dependencies

Next you need to install Bazel. This is the build system used to compile the project.

The Bazel build scripts will automatically download most of the required dependencies for the project, but the following need to be installed manually on your system:

To install these dependencies via apt on Ubuntu, first follow the instructions on Mono’s website to add their apt repository. Then run the following command:

sudo apt-get install mono-complete python-setuptools python-virtualenv \
python-dev autoconf libtool luarocks texlive-latex-base \
texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra \
libxml2-dev libxslt1-dev librsvg2-bin

Set Up your Environment

Before building kRPC you need to make lib/ksp point to a directory containing Kerbal Space Program. For example on Linux, if your KSP directory is at /path/to/ksp and your kRPC source tree is at /path/to/krpc you can create a symlink using ln -s /path/to/ksp /path/to/krpc/lib/ksp

You may also need to modify the symlink at lib/mono-4.5 to point to the correct location of your Mono installation.

Building using Bazel

To build the kRPC release archive, run bazel build //:krpc. The resulting archive containing the GameData directory, client libraries etc will be created at bazel-out/krpc-<version>.zip.

The build scripts also define targets for the different parts of the project. They can be built using bazel build <target>:

  • //server builds the server plugin and associated files
  • Targets for building individual clients:
    • //client/csharp
    • //client/cpp
    • //client/java
    • //client/lua
    • //client/python
  • Targets for building individual services:
    • //service/SpaceCenter
    • //service/Drawing
    • //service/UI
    • //service/InfernalRobotics
    • //service/KerbalAlarmClock
    • //service/RemoteTech
  • Targets for building protobuf definitions for individual languages:
    • //protobuf/csharp
    • //protobuf/cpp
    • //protobuf/java
    • //protobuf/lua
    • //protobuf/python
  • //doc:html builds the HTML documentation
  • //doc:pdf builds the PDF documentation

There are also several convenience scripts:

  • tools/ – builds the documentation and serves it from http://localhost:8080
  • tools/ – builds the plugin and the testing tools, and installs them into the GameData directory of the copy of KSP found at lib/ksp.

Building the C# projects using an IDE

A C# solution file (kRPC.sln) is provided in the root of the project for use with MonoDevelop or a similar C# IDE.

Some of the C# source files it references are generated by the Bazel build scripts. You need to run bazel build //:csproj to generate these files before the solution can be built.

Alternatively, if you are unable to run Bazel to build these files, you can download them from GitHub. Simply extract this archive over your copy of the source and you are good to go.

Running the Tests

kRPC contains a suite of tests for the server plugin, services, client libraries and others.

To run the tests, the following dependencies should be installed. Without them, some of the tests will fail.

  • Gendarme
  • CppCheck
  • socat

To install these dependencies via apt on Ubuntu run the following command:

sudo apt-get install gendarme cppcheck socat

The tests, which do not require KSP to be running, can be executed using: bazel test //:test

kRPC also includes a suite of tests that require KSP to be running. First run tools/ to build kRPC and a testing tools DLL, and install them into the GameData directory of the copy of KSP found at lib/ksp. Then run KSP, load a save game and start the server (with automatically accept client connections enabled). Then install the krpc python client, the krpctest package (built by target //tools/krpctest) and run the scripts to test a particular service, for example those found in service/SpaceCenter/test. These tests will automatically load a save game called krpctest, launch a vessel and run various tests on it.