## Overview
Complete installation instructions for the DAP SDK across all supported platforms. This guide covers prerequisites, installation methods, configuration, and verification steps to get you started with DAP SDK development. The installation includes all core modules: Core, Crypto, I/O, Net (including Client, Server, Stream, and Link Manager submodules), Global DB, Plugin, and Test.
**Supported Platforms:**
- **Linux** - Ubuntu 20.04+, Debian 11+, CentOS 8+, RHEL 8+, Fedora 34+
- **macOS** - macOS 11.0+ (Big Sur and later)
- **Windows** - Windows 10/11 with WSL2 or native builds
## Quick Install
### Package Managers (Recommended)
#### Ubuntu/Debian
```bash
# Add DAP SDK repository
curl -fsSL https://packages.demlabs.net/dap-sdk/gpg | sudo apt-key add -
echo "deb https://packages.demlabs.net/dap-sdk/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/dap-sdk.list
# Update package list and install
sudo apt update
sudo apt install dap-sdk-dev
# Verify installation
dap-sdk-config --version
```
#### CentOS/RHEL/Fedora
```bash
# Add DAP SDK repository
sudo dnf config-manager --add-repo https://packages.demlabs.net/dap-sdk/rpm/dap-sdk.repo
# Install DAP SDK
sudo dnf install dap-sdk-devel
# Verify installation
dap-sdk-config --version
```
#### macOS (Homebrew)
```bash
# Add DAP SDK tap
brew tap demlabs/dap-sdk
# Install DAP SDK
brew install dap-sdk
# Verify installation
dap-sdk-config --version
```
#### Windows (WSL2)
```powershell
# Install WSL2 with Ubuntu
wsl --install -d Ubuntu
# Inside WSL2, follow Ubuntu installation steps
wsl
curl -fsSL https://packages.demlabs.net/dap-sdk/gpg | sudo apt-key add -
# ... continue with Ubuntu steps
```
## Prerequisites
### System Requirements
**Minimum Hardware:**
- **CPU:** x86_64 or ARM64 processor
- **RAM:** 2GB available memory
- **Disk:** 1GB free space for SDK and dependencies
- **Network:** Internet connection for installation and updates
**Recommended Hardware:**
- **CPU:** Multi-core x86_64 processor (4+ cores)
- **RAM:** 8GB+ available memory
- **Disk:** 5GB+ free space for development
- **Network:** Stable broadband connection
### Software Dependencies
#### Linux Dependencies
```bash
# Ubuntu/Debian
sudo apt update
sudo apt install -y \
build-essential \
cmake \
git \
libssl-dev \
libpthread-stubs0-dev \
libjson-c-dev \
libsqlite3-dev \
libcurl4-openssl-dev \
pkg-config
# CentOS/RHEL/Fedora
sudo dnf install -y \
gcc \
gcc-c++ \
cmake \
git \
openssl-devel \
json-c-devel \
sqlite-devel \
libcurl-devel \
pkgconfig
```
#### macOS Dependencies
```bash
# Install Xcode Command Line Tools
xcode-select --install
# Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install dependencies
brew install cmake git openssl json-c sqlite3 curl pkg-config
```
#### Windows Dependencies
```powershell
# Install Visual Studio 2019/2022 with C++ workload
# Or install Build Tools for Visual Studio
# Install vcpkg for package management
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
# Install dependencies
.\vcpkg install openssl:x64-windows json-c:x64-windows sqlite3:x64-windows curl:x64-windows
```
## Manual Installation
### Download Source Code
#### From Git Repository
```bash
# Clone the repository
git clone https://gitlab.demlabs.net/dap/dap-sdk.git
cd dap-sdk
# Switch to stable branch
git checkout stable
# Initialize submodules
git submodule update --init --recursive
```
#### From Release Archive
```bash
# Download latest release
wget https://gitlab.demlabs.net/dap/dap-sdk/-/archive/v1.0.0/dap-sdk-v1.0.0.tar.gz
# Extract archive
tar -xzf dap-sdk-v1.0.0.tar.gz
cd dap-sdk-v1.0.0
```
### Build Configuration
#### Standard Build
```bash
# Create build directory
mkdir build && cd build
# Configure build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DDAP_SDK_BUILD_TESTS=ON \
-DDAP_SDK_BUILD_EXAMPLES=ON \
..
# Build the SDK
make -j$(nproc)
# Run tests (optional)
make test
# Install system-wide
sudo make install
```
#### Development Build
```bash
# Configure for development
cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/.local \
-DDAP_SDK_BUILD_TESTS=ON \
-DDAP_SDK_BUILD_EXAMPLES=ON \
-DDAP_SDK_ENABLE_SANITIZERS=ON \
-DDAP_SDK_ENABLE_COVERAGE=ON \
..
# Build with debug information
make -j$(nproc)
# Install to local directory
make install
```
#### Custom Configuration Options
```bash
# Available build options
cmake -LH .. | grep DAP_SDK
# Common options:
# -DDAP_SDK_BUILD_SHARED=ON/OFF # Build shared libraries
# -DDAP_SDK_BUILD_STATIC=ON/OFF # Build static libraries
# -DDAP_SDK_BUILD_TESTS=ON/OFF # Build test suite
# -DDAP_SDK_BUILD_EXAMPLES=ON/OFF # Build example applications
# -DDAP_SDK_BUILD_DOCS=ON/OFF # Build documentation
# -DDAP_SDK_ENABLE_LOGGING=ON/OFF # Enable logging support
# -DDAP_SDK_ENABLE_CRYPTO=ON/OFF # Enable cryptographic features
# -DDAP_SDK_ENABLE_NETWORKING=ON/OFF # Enable networking features
```
### Platform-Specific Instructions
#### Linux Build
```bash
# Install platform-specific dependencies
sudo apt install -y linux-headers-$(uname -r)
# Configure with Linux optimizations
cmake -DCMAKE_BUILD_TYPE=Release \
-DDAP_SDK_PLATFORM_OPTIMIZATIONS=ON \
-DDAP_SDK_USE_EPOLL=ON \
..
make -j$(nproc)
sudo make install
sudo ldconfig
```
#### macOS Build
```bash
# Set macOS deployment target
export MACOSX_DEPLOYMENT_TARGET=11.0
# Configure with macOS settings
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DDAP_SDK_USE_KQUEUE=ON \
..
make -j$(sysctl -n hw.ncpu)
make install
```
#### Windows Build
```powershell
# Open Developer Command Prompt for VS 2019/2022
# Configure with vcpkg toolchain
cmake -DCMAKE_TOOLCHAIN_FILE=path\to\vcpkg\scripts\buildsystems\vcpkg.cmake ^
-DCMAKE_BUILD_TYPE=Release ^
-DDAP_SDK_USE_IOCP=ON ^
..
# Build with MSBuild
cmake --build . --config Release
# Install
cmake --install . --config Release
```
## Environment Setup
### Environment Variables
#### Linux/macOS
```bash
# Add to ~/.bashrc or ~/.zshrc
export DAP_SDK_ROOT="/usr/local"
export PKG_CONFIG_PATH="$DAP_SDK_ROOT/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$DAP_SDK_ROOT/lib:$LD_LIBRARY_PATH"
export PATH="$DAP_SDK_ROOT/bin:$PATH"
# Reload shell configuration
source ~/.bashrc
```
#### Windows
```cmd
# Set environment variables (permanent)
setx DAP_SDK_ROOT "C:\Program Files\DAP SDK"
setx PATH "%PATH%;%DAP_SDK_ROOT%\bin"
# For current session
set DAP_SDK_ROOT=C:\Program Files\DAP SDK
set PATH=%PATH%;%DAP_SDK_ROOT%\bin
```
### pkg-config Configuration
Create or verify pkg-config file:
```bash
# Check if pkg-config finds DAP SDK
pkg-config --exists dap-sdk && echo "DAP SDK found" || echo "DAP SDK not found"
# Show DAP SDK version
pkg-config --modversion dap-sdk
# Show compiler flags
pkg-config --cflags dap-sdk
# Show linker flags
pkg-config --libs dap-sdk
```
## Installation Verification
### Basic Verification
```bash
# Check SDK installation
dap-sdk-config --version
dap-sdk-config --prefix
dap-sdk-config --cflags
dap-sdk-config --libs
# Verify library presence
ls -la $(dap-sdk-config --prefix)/lib/libdap-*.so
# Check header files
ls -la $(dap-sdk-config --prefix)/include/dap/
```
### Compile Test Program
Create a test file `test_dap.c`:
```c
#include <stdio.h>
#include <dap/dap_common.h>
int main() {
// Initialize DAP SDK
if (dap_common_init("test_app", NULL) != 0) {
fprintf(stderr, "Failed to initialize DAP SDK\n");
return 1;
}
printf("DAP SDK initialized successfully!\n");
printf("Version: %s\n", dap_get_version());
// Cleanup
dap_common_deinit();
return 0;
}
```
Compile and run:
```bash
# Using pkg-config
gcc $(pkg-config --cflags dap-sdk) -o test_dap test_dap.c $(pkg-config --libs dap-sdk)
# Or using dap-sdk-config
gcc $(dap-sdk-config --cflags) -o test_dap test_dap.c $(dap-sdk-config --libs)
# Run the test
./test_dap
```
Expected output:
```
DAP SDK initialized successfully!
Version: 1.0.0
```
### Advanced Verification
#### Test All Modules
```bash
# Run comprehensive test suite
dap-sdk-test --all
# Test specific modules
dap-sdk-test --module core
dap-sdk-test --module crypto
dap-sdk-test --module io
dap-sdk-test --module net
```
#### Performance Benchmark
```bash
# Run performance benchmarks
dap-sdk-benchmark --quick
# Detailed performance test
dap-sdk-benchmark --full --output benchmark_results.json
```
#### Memory Test
```bash
# Test for memory leaks
valgrind --leak-check=full ./test_dap
# Expected: All heap blocks were freed -- no leaks are possible
```
## Configuration
### Default Configuration
DAP SDK uses configuration files for runtime settings:
```bash
# System-wide configuration
/etc/dap-sdk/dap.conf
# User-specific configuration
~/.config/dap-sdk/dap.conf
# Application-specific configuration
./dap.conf
```
### Configuration File Format
Create `~/.config/dap-sdk/dap.conf`:
```ini
[core]
log_level=info
log_file=/var/log/dap-sdk/app.log
debug_mode=false
[memory]
pool_size=67108864 # 64MB
enable_tracking=true
[crypto]
default_hash=sha256
secure_random=true
[network]
default_timeout=30000
max_connections=1000
enable_ipv6=true
[io]
worker_threads=4
event_loop=auto
buffer_size=65536
```
### Runtime Configuration
Applications can override configuration:
```c
#include <dap/dap_config.h>
int main() {
// Set configuration before initialization
dap_config_set_string("core", "log_level", "debug");
dap_config_set_int("memory", "pool_size", 128 * 1024 * 1024);
// Initialize with custom configuration
if (dap_common_init("myapp", NULL) != 0) {
return 1;
}
// Application code...
dap_common_deinit();
return 0;
}
```
## Troubleshooting
### Common Installation Issues
#### Missing Dependencies
```bash
# Error: Could not find required package
# Solution: Install missing dependencies
sudo apt install libssl-dev # Ubuntu/Debian
sudo dnf install openssl-devel # CentOS/RHEL/Fedora
```
#### Permission Denied
```bash
# Error: Permission denied during install
# Solution: Use proper permissions
sudo make install # For system-wide install
# OR
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. # For user install
```
#### Library Not Found
```bash
# Error: libdap-core.so: cannot open shared object file
# Solution: Update library path
sudo ldconfig
# OR add to LD_LIBRARY_PATH
export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
```
#### CMake Version Too Old
```bash
# Error: CMake 3.16 or higher is required
# Solution: Install newer CMake
wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.sh
chmod +x cmake-3.24.0-linux-x86_64.sh
sudo ./cmake-3.24.0-linux-x86_64.sh --prefix=/usr/local --skip-license
```
### Build Issues
#### Out of Memory During Build
```bash
# Reduce parallel jobs
make -j2 # Instead of make -j$(nproc)
# Or use swap if needed
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
```
#### Compilation Errors
```bash
# Clear build cache
rm -rf build/
mkdir build && cd build
# Reconfigure with verbose output
cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
make VERBOSE=1
```
### Getting Help
- **Documentation**: [[Development Guide|Development Guide]] for advanced topics
- **Issues**: Report bugs at https://gitlab.demlabs.net/dap/dap-sdk/issues
- **Community**: Join DAP SDK discussions at https://forum.demlabs.net
- **Support**: Contact
[email protected] for commercial support
## Next Steps
After successful installation:
1. **[[First Application|First Application]]** - Create your first DAP SDK application
2. **[[Architecture Overview|Architecture Overview]]** - Understand the SDK architecture
3. **[[Development Guide|Development Guide]]** - Learn development best practices
4. **[[Modules/Module Overview|Module Overview]]** - Explore SDK modules and capabilities
---
*Last updated: December 2024 | Version: 1.0 | Installation Guide for DAP SDK*