Skip to the content.

Building from Source

Table of Contents

Prerequisites

On Debian/Ubuntu, the additional system packages are:

sudo apt-get update
sudo apt-get install -y \
  build-essential cmake ninja-build pkg-config git python3 \
  curl ca-certificates perl libssl-dev \
  libjson-c-dev libcurl4-openssl-dev uuid-dev

libjson-c-dev, libcurl4-openssl-dev, and uuid-dev are the development packages the TPM2-TSS source build links against. They are the only required system libraries beyond the toolchain: the normal Linux build compiles TPM2-TSS 4.1.3 from source.

With LEMONADE_NEXUS_STATIC_DEPS=ON (the default), the Linux build accepts only the pinned OpenSSL version (LEMONADE_NEXUS_OPENSSL_VERSION_UBUNTU in cmake/libraries/openssl.cmake, 3.0.13 from Ubuntu 24.04 libssl-dev) and links its static libraries. Executables also link libstdc++ and libgcc statically. glibc stays a shared dependency. The attestation profile pins the hash of each shared library the server loads, so an OS update of OpenSSL, zlib, zstd, or the C++ runtime cannot change what attestation measures (see Releasing). On another distribution, or for a distribution package, configure with -DLEMONADE_NEXUS_STATIC_DEPS=OFF. The build then uses the system OpenSSL. A client SDK build (-DLEMONADE_NEXUS_SDK_ONLY=ON) always uses the system OpenSSL 3 on Linux: attestation measures only the fleet executables.

On macOS arm64 and Windows x64, LEMONADE_NEXUS_STATIC_DEPS=ON downloads a pinned static OpenSSL archive, checks its SHA-256, and links it. The build does not compile OpenSSL and does not use Homebrew or vcpkg. See Embedded libraries.

Dependencies are not all fetched automatically. They use a mix of CMake FetchContent (most C/C++ libraries), a pinned OpenSSL archive (macOS and Windows), source builds (TPM2-TSS), system packages (json-c, libcurl, UUID, and OpenSSL on Linux), and Cargo (the Rust crates). See Dependencies and the CMake library definitions for the actual sourcing and versions.

Linux Build

git clone https://github.com/lemonade-sdk/lemonade-nexus.git
cd lemonade-nexus
cmake -S . -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_TESTING=ON
cmake --build build --parallel

The server binary is at build/projects/LemonadeNexus/lemonade-nexus.

Install

On Debian/Ubuntu, build and install the package so the service user, bootstrap command, evidence helper, and systemd units install together:

cpack --config build/CPackConfig.cmake -G DEB -B build/packages
sudo apt install ./build/packages/lemonade-nexus-*.deb

The package enables the services without starting them. Follow Getting Started to bootstrap the protected configuration and configure public DNS before starting.

Other generators: cpack --config build/CPackConfig.cmake -G RPM -B build/packages (Fedora/RPM), -G productbuild (macOS), -G TGZ (portable archive). The current DEB/RPM metadata targets x86-64; review the packaging definitions before building for another architecture.

macOS Build

cmake -S . -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_TESTING=ON
cmake --build build --parallel

The configure step downloads the pinned static OpenSSL archive for macOS arm64 and links it, so the binaries do not load a Homebrew or system OpenSSL. The archive holds arm64 code only: a universal or x86_64 build (CMAKE_OSX_ARCHITECTURES) needs -DLEMONADE_NEXUS_STATIC_DEPS=OFF and a system OpenSSL.

macOS builds run in CI on every push.

Windows Status

Windows build and packaging definitions exist in the tree (MSVC with the pinned static OpenSSL archive for Windows x64, NSIS/ZIP in CPack, a Windows durable-write path in the security stores). CI coverage is partial:

Treat the Windows server as unsupported until the native jobs are re-enabled and passing.

Flutter Client App

The desktop client (apps/LemonadeNexusClient) is a Flutter app that talks to the C SDK over FFI. Build the SDK shared library first, then run Flutter.

macOS

# 1. Build the SDK dylib from the repo root. The pinned static OpenSSL archive
#    is linked in, so the dylib loads no Homebrew or system OpenSSL. This
#    matches the CI build.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target LemonadeNexusSDKShared --parallel

# 2. Run / build the app — the Xcode "Embed Lemonade Nexus SDK" build phase
#    copies and codesigns the dylib into the .app automatically
cd apps/LemonadeNexusClient
flutter pub get
flutter run -d macos              # development (hot reload)
flutter build macos --release     # release build

Output: build/macos/Build/Products/Release/nexus-client.app. Set LN_DEBUG=1 to surface verbose SDK and mesh diagnostics in the console.

Windows

See the Windows packaging guide. The SDK DLL must be staged next to the runner before flutter build windows.

Linux

# 1. Build the SDK alone. On Linux it links the system OpenSSL 3.
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_TESTING=OFF -DLEMONADE_NEXUS_SDK_ONLY=ON
cmake --build build --target LemonadeNexusSDKShared --parallel

# 2. Build the app. The runner's CMake bundles
#    build/projects/LemonadeNexusSDK/liblemonade_nexus_sdk.so into lib/.
cd apps/LemonadeNexusClient
flutter pub get
flutter build linux --release

The Flutter Linux toolchain needs clang and GTK 3; the plugins need libsecret, jsoncpp, and the Ayatana app indicator development packages. See the linux job in the workflow below for the exact package list.

CI builds and sanity-checks the macOS, Windows, and Linux clients — see .github/workflows/flutter-clients.yml.

iOS and Android SDK

The Flutter plugin packages/lemonade_nexus_sdk carries the SDK for iOS and Android. scripts/build-sdk-mobile.sh builds it against pinned OpenSSL 3.5.9 mobile archives (.github/workflows/deps-openssl-mobile.yml). The Mobile SDK workflow (.github/workflows/mobile-sdk.yml) builds both platforms, tests the plugin, and, with a mobile-sdk-v<version> release tag, uploads the archives. See the plugin’s native library notes.

Running Tests

ctest --test-dir build --output-on-failure --parallel

Or, from the build directory: ctest --output-on-failure -j$(nproc).

CTest discovers GoogleTest case names; use the names from ctest -N with ctest -R to select focused tests. Hardware-dependent tests (TPM, real SEV-SNP evidence, loopback-timing-sensitive cases) skip when their environment is absent. A skipped hardware test is not production qualification evidence. Do not quote a fixed test count — the suite size changes between revisions.

Useful scoped checks:

ctest --test-dir build -N
cmake --build build --target LemonadeNexusSDKShared --parallel

For Rust-only changes, run the relevant crate’s checks from its manifest path (crates/boringtun-ffi, crates/virtual-netstack, crates/frost-ffi, crates/storage-threshold) with cargo test --locked, and preserve the lockfile.

With BUILD_TESTING on, the build also has nexus-e2e, the live end-to-end client. CTest runs only its offline self-test (LiveE2E.SelfTest). The Live SDK E2E workflow runs the full scenario against the production fleet; see Live SDK E2E.

Dependencies

Sourcing is mixed; the CMake library definitions and Cargo manifests are the source of truth for versions.

Component Sourcing Purpose
libsodium FetchContent (1.0.20) Ed25519, X25519, AEAD, HKDF, random
OpenSSL Linux: Ubuntu 24.04 libssl-dev 3.0.13, linked statically (client SDK build: system OpenSSL 3); macOS arm64 / Windows x64: pinned static archive (3.5.9), checked by SHA-256; LEMONADE_NEXUS_STATIC_DEPS=OFF: system package TLS, ACME client
TPM2-TSS (FAPI) Source build (4.1.3), Linux TPM access for the evidence helper
asio FetchContent (1.34.2) Async I/O (UDP, timers)
cpp-httplib FetchContent (0.61.0); the client SDK also builds against a system library from 0.26.0 (the event socket needs 0.47.0) HTTP/HTTPS server and client, WebSocket event socket
c-ares FetchContent (1.34.6) Async DNS resolution
nlohmann/json FetchContent (3.12.0) JSON parsing
spdlog FetchContent (1.16.0) Structured logging
jwt-cpp FetchContent (0.7.0) JWT session tokens
magic_enum FetchContent (0.9.7) Enum reflection
xxHash FetchContent (0.8.3) Non-cryptographic hashing (dedup caches)
SQLite FetchContent amalgamation (3.46.1) Application storage (ACL store)
BoringTun Rust crate via Corrosion (crates/boringtun-ffi) Userspace WireGuard
virtual netstack Rust crate (crates/virtual-netstack) Userspace TCP/IP (smoltcp)
FROST Rust crate (crates/frost-ffi, frost-ed25519 = 2.2.0) Threshold authority signatures
Storage threshold Rust crate (crates/storage-threshold, frost-ristretto255 = 2.2.0, elastic-elgamal = 0.3.1) Threshold storage key; the server links it for storage-key generation, refresh, and unlock
json-c, libcurl, UUID System packages (Linux) TPM2-TSS build dependencies