Building optillm-rs¶
Guide for building the optillm-rs project from source.
Prerequisites¶
- Rust 1.75+ (install)
- Cargo
- Git
Installation¶
Bash
# Clone the repository
git clone https://github.com/coohom/optillm-rs.git
cd optillm-rs
# Install Rust (if needed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Building¶
Bash
# Build all crates in release mode
cargo build --release
# Build specific crate
cargo build --release -p optillm-mars
# Build for development (faster, unoptimized)
cargo build
# Check code without building (faster)
cargo check --all
Running Tests¶
Bash
# Run all tests
cargo test --all
# Run tests for specific crate
cargo test -p optillm-core
# Run with output
cargo test -- --nocapture
# Run single test
cargo test test_name --
Features¶
Bash
# Build with all features
cargo build --all-features
# Build with specific features
cargo build --features "feature1,feature2"
Documentation¶
Bash
# Generate and open documentation
cargo doc --all --open
# Generate without opening
cargo doc --all
Workspace Structure¶
Text Only
optillm-rs/
├── crates/
│ ├── core/ # Core traits and types
│ └── mars/ # MARS implementation
├── Cargo.toml # Workspace configuration
└── Cargo.lock # Locked dependencies
Dependency Management¶
Bash
# Update dependencies
cargo update
# Check for outdated dependencies
cargo outdated
# Verify dependency tree
cargo tree
Troubleshooting¶
Clean Build¶
Bash
# Remove build artifacts
cargo clean
# Rebuild from scratch
cargo build --release
Compiler Errors¶
Bash
# Update Rust
rustup update
# Check Rust version
rustc --version
Dependency Issues¶
Bash
# Fetch latest dependencies
cargo update
# Lock to specific version
# Edit Cargo.toml version constraints
Performance¶
Bash
# Optimize for performance
cargo build --release -C opt-level=3
# Profile build time
cargo build -Z timings
Platform-Specific¶
macOS¶
Bash
# Ensure Xcode Command Line Tools installed
xcode-select --install
cargo build --release
Linux¶
Bash
# Install build tools (Ubuntu/Debian)
sudo apt-get install build-essential
cargo build --release
Windows¶
Bash
# Use Visual Studio Build Tools
# Then build normally
cargo build --release
See Testing for detailed testing instructions.