This guide provides detailed instructions for setting up KalamDB for development on Windows, macOS, and Linux.
- System Requirements
- Platform-Specific Setup Guides
- Windows Setup
- macOS Setup
- Linux Setup
- Verify Installation
- Build and Run
- Troubleshooting
For detailed, platform-specific setup instructions with comprehensive troubleshooting:
-
📖 macOS Setup Guide - Complete guide for macOS (Intel & Apple Silicon)
- Includes fix for
libclang.dylibloading issues - Xcode Command Line Tools setup
- Homebrew and LLVM configuration
- Includes fix for
-
📖 Linux Setup Guide - Covers Ubuntu, Debian, Fedora, Arch, and more
- Distribution-specific package installation
- LLVM and build tools setup
- Performance optimization tips
-
📖 Windows Setup Guide - Complete Windows setup with Visual Studio
- Visual Studio Build Tools installation
- LLVM/Clang configuration
- PowerShell commands and troubleshooting
- Rust: 1.92 or later
- LLVM/Clang: Required for RocksDB compilation
- C++ Compiler: Required for native dependencies
- Git: For cloning the repository
- Minimum RAM: 4GB (8GB recommended)
- Disk Space: 2GB for dependencies and build artifacts
KalamDB depends on several native libraries that require C/C++ compilation:
- RocksDB: High-performance embedded database (C++)
- Arrow/Parquet: Columnar data format libraries (C++)
- DataFusion: SQL query engine with native components
Without LLVM/Clang and a C++ compiler, the Rust build process will fail when compiling these dependencies.
KalamDB requires the Microsoft Visual C++ (MSVC) build tools for compiling native dependencies.
- Download Visual Studio 2022 Community Edition
- Run the installer
- Select "Desktop development with C++" workload
- Ensure these components are checked:
- MSVC v143 - VS 2022 C++ x64/x86 build tools
- Windows 10/11 SDK
- C++ CMake tools for Windows
- Click "Install" (requires ~7GB disk space)
- Download Visual Studio Build Tools 2022
- Run the installer
- Select "C++ build tools" workload
- Click "Install"
LLVM/Clang is required for bindgen (used by RocksDB bindings).
- Download LLVM for Windows
- Get the latest stable release (e.g.,
LLVM-17.0.6-win64.exe)
- Get the latest stable release (e.g.,
- Run the installer
- Important: Check "Add LLVM to the system PATH" during installation
- Complete the installation
- Download rustup-init.exe
- Run the installer
- Follow the prompts (default options are recommended)
- Choose the MSVC toolchain when prompted
- Restart your terminal/PowerShell after installation
Open PowerShell and verify:
# Check LLVM installation
clang --version
# Should output something like:
# clang version 17.0.6
# Target: x86_64-pc-windows-msvcIf clang is not found, add LLVM to your PATH manually:
# Add to system PATH (adjust version number as needed)
$env:Path += ";C:\Program Files\LLVM\bin"To make this permanent:
- Open "System Properties" → "Environment Variables"
- Edit "Path" under "System variables"
- Add
C:\Program Files\LLVM\bin
Some Rust crates need to locate LLVM:
# Set LIBCLANG_PATH (adjust path if needed)
[System.Environment]::SetEnvironmentVariable('LIBCLANG_PATH', 'C:\Program Files\LLVM\bin', 'User')
# Verify
$env:LIBCLANG_PATH# Clone the repository
git clone https://github.com/kalamdb/KalamDB.git
cd KalamDB\backend
# Build the project (first build will take 10-20 minutes)
cargo build
# Run tests
cargo testThe Xcode Command Line Tools provide the C++ compiler and build tools.
# Install Xcode Command Line Tools
xcode-select --install
# Verify installation
clang --version
# Should show: Apple clang version 14.0.0 (or later)While macOS includes clang, installing LLVM via Homebrew ensures compatibility:
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install LLVM
brew install llvm
# Add LLVM to PATH (add to ~/.zshrc or ~/.bash_profile)
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"' >> ~/.zshrc
# Configure dynamic linker for RocksDB (CRITICAL for macOS)
echo 'export DYLD_FALLBACK_LIBRARY_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH"' >> ~/.zshrc
# Reload shell configuration
source ~/.zshrcNote for Intel Macs: Replace /opt/homebrew with /usr/local in the paths above.
Why DYLD_FALLBACK_LIBRARY_PATH? This environment variable is critical for RocksDB compilation on macOS. Without it, you may encounter libclang.dylib loading errors. See the macOS Setup Guide for details.
# Download and install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Follow the prompts (default options recommended)
# Reload PATH
source $HOME/.cargo/env
# Verify installation
rustc --version
cargo --version# Install CMake (required for some dependencies)
brew install cmake
# Install pkg-config (helps Rust find native libraries)
brew install pkg-config# Clone the repository
git clone https://github.com/kalamdb/KalamDB.git
cd KalamDB/backend
# Build the project (first build will take 10-20 minutes)
cargo build
# Run tests
cargo test# Update package list
sudo apt update
# Install essential build tools
sudo apt install -y build-essential
# Install LLVM, Clang, and development libraries
sudo apt install -y llvm clang libclang-dev
# Install additional dependencies
sudo apt install -y cmake pkg-config libssl-dev git
# Verify installation
clang --version
# Should show: Ubuntu clang version 14.0.0 (or later)# Download and install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Follow the prompts (default options recommended)
# Reload PATH
source $HOME/.cargo/env
# Verify installation
rustc --version
cargo --version# Clone the repository
git clone https://github.com/kalamdb/KalamDB.git
cd KalamDB/backend
# Build the project (first build will take 10-20 minutes)
cargo build
# Run tests
cargo test# Install development tools
sudo dnf groupinstall -y "Development Tools"
# Install LLVM and Clang
sudo dnf install -y llvm clang clang-devel
# Install additional dependencies
sudo dnf install -y cmake pkgconfig openssl-devel git
# Verify installation
clang --version# Download and install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Follow the prompts (default options recommended)
# Reload PATH
source $HOME/.cargo/env
# Verify installation
rustc --version
cargo --version# Clone the repository
git clone https://github.com/kalamdb/KalamDB.git
cd KalamDB/backend
# Build the project
cargo build
# Run tests
cargo test# Install base development tools
sudo pacman -S base-devel
# Install LLVM, Clang, and dependencies
sudo pacman -S llvm clang cmake pkg-config openssl git
# Verify installation
clang --version# Option 1: Via rustup (recommended)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
# Option 2: Via pacman
sudo pacman -S rust
# Verify installation
rustc --version
cargo --version# Clone the repository
git clone https://github.com/kalamdb/KalamDB.git
cd KalamDB/backend
# Build the project
cargo build
# Run tests
cargo testAfter completing the setup for your platform, verify everything is working:
# Check Rust version (should be 1.92 or later)
rustc --version
# Check cargo version
cargo --version
# Check installed toolchain
rustup show# Windows (PowerShell)
cl.exe
# macOS/Linux
clang --version
gcc --versionclang --version
# Should output version information
# Example: clang version 14.0.0 or later# Navigate to backend directory
cd KalamDB/backend
# Clean build (removes previous artifacts)
cargo clean
# Build in debug mode
cargo build
# Build in release mode (optimized, slower to compile)
cargo build --releasecd backend
# Build all crates
cargo build
# Build specific crate
cargo build -p kalamdb-core
cargo build -p kalamdb-api
cargo build -p kalamdb-server
# Run the server (API-only; add `--features embedded-ui` for the admin UI)
cargo run
# Run with logging
RUST_LOG=debug cargo run --features embedded-ui# Build optimized release version
cargo build --release
# Run release build
./target/release/kalamdb-server# Copy example configuration
cp config.example.toml config.toml
# Edit configuration with your settings
# Default server: http://127.0.0.1:2900# Run all tests
cargo test
# Run specific test
cargo test test_message_storage
# Run integration tests only
cargo test --test '*'
# Run with output
cargo test -- --nocapture
# Run with logging
RUST_LOG=debug cargo test# Check for errors (faster than full build)
cargo check
# Run linter
cargo clippy
# Format code
cargo fmt
# Check formatting without changing files
cargo fmt -- --checkCause: Visual Studio Build Tools not installed or not in PATH.
Solution:
- Install Visual Studio Build Tools (see Windows Setup Step 1)
- Restart your terminal after installation
- Verify with:
where cl.exe
Cause: LLVM/Clang not installed or not in PATH.
Solution:
Windows:
# Set LIBCLANG_PATH
$env:LIBCLANG_PATH = "C:\Program Files\LLVM\bin"macOS:
# Set dynamic library fallback path (CRITICAL for RocksDB)
export DYLD_FALLBACK_LIBRARY_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH"
# Make permanent (add to ~/.zshrc)
echo 'export DYLD_FALLBACK_LIBRARY_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib:$DYLD_FALLBACK_LIBRARY_PATH"' >> ~/.zshrcLinux:
sudo apt install libclang-dev # Ubuntu/Debian
sudo dnf install clang-devel # Fedora/RHELSee also: macOS libclang troubleshooting
Cause: Missing C++ compiler or build tools.
Solution:
- Windows: Install Visual Studio Build Tools
- macOS: Install Xcode Command Line Tools (
xcode-select --install) - Linux: Install build-essential (
sudo apt install build-essential)
Cause: Rust compiles dependencies from source, including large C++ libraries.
Solution:
-
First build: Will take 10-20 minutes (normal)
-
Subsequent builds: Should be much faster (incremental compilation)
-
Use
cargo check: Faster thancargo buildfor catching errors -
Enable faster linker:
Create or edit
~/.cargo/config.toml:# macOS/Linux [target.x86_64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=lld"] # Windows [target.x86_64-pc-windows-msvc] rustflags = ["-C", "link-arg=/DEBUG:NONE"]
Cause: Insufficient RAM for parallel compilation.
Solution:
Create or edit ~/.cargo/config.toml:
[build]
# Reduce parallel compilation jobs
jobs = 2Or use environment variable:
# Limit to 2 parallel jobs
cargo build -j 2Cause: Cached dependencies with mismatched versions.
Solution:
# Clean build artifacts
cargo clean
# Remove dependency cache
rm -rf ~/.cargo/registry
rm -rf ~/.cargo/git
# Rebuild
cargo buildCause: Missing OpenSSL development libraries.
Solution:
# Ubuntu/Debian
sudo apt install libssl-dev pkg-config
# Fedora/RHEL
sudo dnf install openssl-devel pkgconfig
# Arch
sudo pacman -S openssl pkg-configSolution: Ensure you're using the MSVC toolchain (not GNU):
# Check current toolchain
rustup default
# Should show: stable-x86_64-pc-windows-msvc
# If not, switch to MSVC:
rustup default stable-x86_64-pc-windows-msvcSolution: Reinstall Xcode Command Line Tools:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --installSolution: Install additional development libraries:
# Ubuntu/Debian
sudo apt install libssl-dev libclang-dev cmake
# Fedora/RHEL
sudo dnf install openssl-devel clang-devel cmakeIf you encounter issues not covered here:
- Platform-Specific Guides: See detailed troubleshooting in:
- Check GitHub Issues: KalamDB Issues
- Search Rust Forums: Many dependency issues are common across Rust projects
- Enable Verbose Output:
cargo build -vvfor detailed error messages - Check Dependencies: Ensure all system dependencies are installed
Once your development environment is set up:
- Read the Backend README for project structure and development workflow
- Review the Architecture Documentation to understand KalamDB's storage design
- Check out the API Documentation for REST endpoints
- Review the Constitution for development principles
# Build
cargo build # Debug build
cargo build --release # Release build
cargo check # Fast error checking
# Run
cargo run # API-only server (faster compile)
cargo run --features embedded-ui # Serve the admin UI
RUST_LOG=debug cargo run # Run with logging
# Test
cargo test # All tests
cargo test test_name # Specific test
cargo test -- --nocapture # Show output
# Code Quality
cargo clippy # Linter
cargo fmt # Format code
cargo doc --open # Generate and open docs
# Clean
cargo clean # Remove build artifacts# Logging level
RUST_LOG=debug,info,warn,error,trace
# LLVM (if not in PATH)
LIBCLANG_PATH=/path/to/llvm/bin
# Parallel jobs
CARGO_BUILD_JOBS=2Last Updated: December 31, 2025
KalamDB Version: 0.1.3
Minimum Rust Version: 1.92