Building

Complete guide for building NCN Network components from source.


Quick Build

# Build all components (debug)
cargo build

# Build all components (release)
cargo build --release

Build Individual Components

Gateway Node

cargo build -p gateway_node
cargo build --release -p gateway_node

# Binary location
./target/debug/gateway_node
./target/release/gateway_node

Compute Node

P2P Registry Node

Test Client

Common Types Library


Build Features

Gateway Features

Compute Node Features


Build Profiles

Debug Build

  • Includes debug symbols

  • No optimizations

  • Faster compilation

  • Larger binaries

  • Better for debugging

Release Build

  • Optimized for performance

  • Smaller binaries

  • Slower compilation

  • Better for production

Custom Profile


Cross-Compilation

Linux Target from macOS

ARM64 Target


Build Smart Contracts

Contract Artifacts


Build Docker Images

All Images

Individual Images

Multi-stage Build

Docker images use multi-stage builds for smaller images:


Protocol Buffer Generation

Protobuf code is auto-generated during build via build.rs:

Manual Generation


Build Verification

Check Build

Run Tests

Lint Check


Build Troubleshooting

Out of Memory

Slow Builds

Dependency Conflicts

Protobuf Errors


Build Artifacts

Binary Locations

Component
Debug
Release

Gateway

target/debug/gateway_node

target/release/gateway_node

Compute

target/debug/compute_node

target/release/compute_node

Registry

target/debug/p2p_registry_node

target/release/p2p_registry_node

Test Client

target/debug/test_client

target/release/test_client

Binary Sizes (Release)

Binary
Approximate Size

gateway_node

~25 MB

compute_node

~20 MB

p2p_registry_node

~18 MB

test_client

~15 MB


Next Steps

Last updated