Skip to content

Latest commit

 

History

History
145 lines (93 loc) · 3.76 KB

File metadata and controls

145 lines (93 loc) · 3.76 KB

Building KYBER

Prerequisites

  • Clone the repository with --recurse-submodules or run git submodule --init --recursive
  • Download and install Protoc and ensure protoc is in your PATH

Dart/Flutter Projects (Launcher, CLI, Packages)

Prequisites

  • Flutter (master channel)
  • Rust (nightly toolchain)
  • Melos: dart pub global activate melos

Bootstrapping (Required for Launcher & CLI)

Bootstrap the workspace from the repository root:

melos bootstrap

This installs dependencies, generates proto bindings, and runs code generation.

Launcher (Flutter)

Generating FFI Bindings

First you need to generate the FFI bindings:

cd Launcher
dart run tool/ffigen.dart

Run in Debug Mode

From the launcher directory, run:

flutter run

Build Release Binaries

From the launcher directory, run:

flutter build <platform>

Building the Installer

To build the installer on Windows, you can use Inno Setup with the provided installer.iss script located in the installer folder.

CLI (Flutter)

Building the CLI

cd CLI
flutter pub get
flutter_rust_bridge_codegen generate
dart build cli bin/kyber_cli.dart

This will output the binary to build/cli/<platform>/bundle/bin/.

Using the Built CLI

To run the CLI, make sure to copy the rust library from build/cli/<platform>/bundle/lib/ next to the binary.

Important: Make sure to build Maxima first. Then depending on your platform, copy the following files next to the binary from the Maxima build output:

Windows

  • maxima-service.exe
  • maxima-bootstrap.exe

Linux

  • maxima-bootstrap

Module (C++)

Building the KYBER Module

The KYBER Module can only be compiled on Windows, with MSVC.

First, install bazelisk and drop it into your PATH as bazel.exe.

There is a bug with the gRPC client version we're using in combination with Bazel's long build paths, which makes some build paths extend past the legacy Windows path limit. To work around this, make a folder named bz at the root of your drive. We'll be using this folder to store bazel's intermediary files.

Ensure you have MSYS2 installed to C:\msys64.

Run bazel --output_user_root="C:\bz" build --config=release Kyber. This will take a while. Once it's done, you should have Module/bazel-bin/Kyber.dll. You may alternatively run the build.bat file in the root by running .\build.bat and modifying the path to the correct drive.

Important: The module requires the --config=release flag. Building without it (i.e., in debug mode) will lead to crashes.

Using the Built Module

Once built, copy Module/bazel-bin/Kyber.dll to C:/ProgramData/Kyber/Module/Kyber.dll to test your changes with the Launcher or CLI.

Code Completion

The KYBER module is primarily developed using Visual Studio Code with the clangd extension. compile_commands.json can be generated by running clangd/refresh.bat while inside the Module folder.


API (Go)

Requires Go 1.24+ and protoc with Go plugins:

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

Build:

Linux:

cd API
./scripts/gen-proto.sh
go build -o kyber-api ./cmd/server

Windows:

cd API
scripts\gen-proto.bat
go build -o kyber-api.exe ./cmd/server

Proxy (Rust)

Requires Rust nightly and protoc.

cd Proxy
cargo build --release

Output: target/release/kyber_proxy