🦆 Frozen DuckDB Binary
Pre-compiled DuckDB binary that never needs compilation - Fast builds forever!
This project provides architecture-specific DuckDB binaries that eliminate the slow compilation bottleneck in Rust projects using duckdb-rs. Instead of compiling DuckDB from source every time, this project uses pre-compiled official binaries for lightning-fast builds.
🚀 Performance
| Build Type | Before | After | Improvement |
|---|---|---|---|
| First Build | 1-2 minutes | 7-10 seconds | 85% faster |
| Incremental | 30 seconds | 0.11 seconds | 99% faster |
| Release Builds | 1-2 minutes | 0.11 seconds | 99% faster |
📦 What's Included
- Architecture-specific DuckDB v1.4.0 binaries:
libduckdb_x86_64.dylib(55MB) - Intel Macslibduckdb_arm64.dylib(50MB) - Apple Silicon Macs
- C/C++ headers for development
- Smart environment setup with automatic architecture detection
- Build integration with Rust projects
- Arrow compatibility patch for version conflicts
- CLI tool for dataset management and TPC-H benchmark data generation
🛠️ Installation
Option 1: Download Pre-built Binary
# Clone this repository
# Set up environment (automatically detects your architecture)
# Use in your Rust project
Option 2: Build from Source
# Clone this repository
# Build the frozen binary
# Set up environment
🔧 Integration with Your Rust Project
1. Update your Cargo.toml
[]
# Use prebuilt DuckDB - no compilation needed!
= { = "1.4.0", = false }
2. Add build script (build.rs)
use env;
use Path;
3. Set up environment before building
# In your project directory
🎯 Usage Examples
Basic Usage
# Set up the frozen DuckDB environment (auto-detects architecture)
# Build your project (now fast!)
# Run tests
CLI Dataset Management
The frozen-duckdb CLI provides utilities for managing test datasets:
# Generate TPC-H benchmark data (industry standard)
# Generate Chinook sample data
# Convert between formats
# Show system information
TPC-H Dataset Features:
- 8 realistic tables: customer, lineitem, nation, orders, part, partsupp, region, supplier
- Scalable data: From tiny (SF 0.01) to massive datasets (SF 1000+)
- Industry standard: Used for database benchmarking worldwide
- Fast generation: SF 0.01 generates ~86k rows in <1 second
Architecture Detection
The setup script automatically detects your architecture:
# 🍎 Detected Apple Silicon (arm64), using 50MB binary
# 🖥️ Detected x86_64 architecture, using 55MB binary
CI/CD Integration
# GitHub Actions example
- name: Set up frozen DuckDB
run: |
git clone https://github.com/seanchatmangpt/frozen-duckdb.git
source frozen-duckdb/prebuilt/setup_env.sh
echo "DUCKDB_LIB_DIR=$DUCKDB_LIB_DIR" >> $GITHUB_ENV
echo "DUCKDB_INCLUDE_DIR=$DUCKDB_INCLUDE_DIR" >> $GITHUB_ENV
- name: Build with frozen DuckDB
run: cargo build --release
🔍 Troubleshooting
Library Not Found
If you get "library not found" errors:
# Check environment variables
# Verify library exists
# Re-source the environment
Architecture Issues
If you need to force a specific architecture:
# Force x86_64 (Intel Mac)
ARCH=x86_64
# Force arm64 (Apple Silicon)
ARCH=arm64
Arrow Compatibility Issues
If you encounter Arrow version conflicts:
# Apply the Arrow patch
🏗️ Architecture
frozen-duckdb/
├── prebuilt/ # Pre-compiled binaries
│ ├── libduckdb_x86_64.dylib # Intel Mac binary (55MB)
│ ├── libduckdb_arm64.dylib # Apple Silicon binary (50MB)
│ ├── duckdb.h # C header
│ ├── duckdb.hpp # C++ header
│ └── setup_env.sh # Smart environment setup
├── scripts/ # Build and setup scripts
│ ├── build_frozen_duckdb.sh
│ ├── download_duckdb_binaries.sh
│ └── apply_arrow_patch.sh
├── examples/ # Usage examples
└── README.md # This file
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- DuckDB - The amazing analytical database
- duckdb-rs - Rust bindings for DuckDB
- Apache Arrow - Columnar in-memory analytics
📊 Benchmarks
Before Frozen DuckDB
cargo build -p my-duckdb-crate
Compiling libduckdb-sys v1.4.0
Compiling duckdb v1.4.0
Compiling my-duckdb-crate v0.1.0
Finished dev profile [unoptimized + debuginfo] target(s) in 2m 15s
After Frozen DuckDB
source prebuilt/setup_env.sh
cargo build -p my-duckdb-crate
Compiling my-duckdb-crate v0.1.0
Finished dev profile [unoptimized + debuginfo] target(s) in 0.11s
Result: 99% faster builds! 🚀
💡 Architecture-Specific Benefits
- Smaller downloads: Users only get the binary for their architecture
- Faster setup: No need to download unused architecture code
- Better performance: Native architecture optimization
- Reduced storage: 50-55MB per user instead of 105MB universal binary