Skip to content

Building from Source

Detailed instructions for building bindcar from source.

Prerequisites

Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Verify installation:

rustc --version
# Should show: rustc 1.89.0 or later

Install Dependencies

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev

macOS:

brew install openssl

Build Process

Debug Build

cargo build

Output: target/debug/bindcar

Release Build

cargo build --release

Output: target/release/bindcar

Optimizations: - LTO enabled - Optimized for size and speed - Debug symbols stripped

Build Options

Feature Flags

Currently no optional features. All features are enabled by default.

Custom Optimization

Edit Cargo.toml profile:

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
strip = true

Cross-Compilation

Linux ARM64

rustup target add aarch64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnu

Static Binary

rustup target add x86_64-unknown-linux-musl
cargo build --release --target x86_64-unknown-linux-musl

Docker Build

Build Image

docker build -t bindcar:latest .

Multi-arch Build

docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t bindcar:latest \
  --push .

Troubleshooting

OpenSSL Not Found

# Ubuntu/Debian
sudo apt-get install libssl-dev

# macOS
brew install openssl
export OPENSSL_DIR=/usr/local/opt/openssl

Linker Errors

# Install build tools
sudo apt-get install build-essential

Out of Memory

# Reduce parallel jobs
cargo build --release -j 2

Verification

# Run binary
./target/release/bindcar --version

# Test basic functionality
BIND_ZONE_DIR=.tmp/zones ./target/release/bindcar

Next Steps