Building from Source
Complete guide to building Rugo from source code.
Prerequisites
Required
- Python: 3.9 or newer
- C++ Compiler: C++17 compatible
- Git: For cloning the repository
Compiler Requirements
Linux
# Debian/Ubuntu
sudo apt-get update
sudo apt-get install build-essential python3-dev
# Red Hat/Fedora
sudo dnf install gcc-c++ python3-devel
# Arch
sudo pacman -S base-devel python
Requires GCC 7+ or Clang 5+.
macOS
Requires Clang from Xcode 10+.
Windows
Install Visual Studio 2017 or newer with C++ build tools:
- Download Visual Studio Build Tools
- Install "Desktop development with C++"
- Or install Build Tools for Visual Studio
Alternatively, use MinGW-w64.
Quick Start
# Clone repository
git clone https://github.com/mabel-dev/rugo.git
cd rugo
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install build dependencies and compile
make update
make compile
# Install in development mode
pip install -e .
Step-by-Step Build
1. Clone the Repository
2. Set Up Virtual Environment
# Create environment
python -m venv .venv
# Activate (Linux/macOS)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activate
3. Install Build Dependencies
Using the Makefile:
Or manually:
4. Compile the Extension
Using the Makefile:
This: - Removes old build artifacts - Compiles Cython code - Builds C++ extension with -O3 optimization - Uses C++17 standard
Or manually:
# Clean old builds
rm -rf build/ rugo/parquet/*.cpp rugo/parquet/*.so
# Build extension
python setup.py build_ext --inplace
5. Verify Installation
Build Options
Debug Build
For development with debug symbols:
# Set environment variable
export CFLAGS="-g -O0"
export CXXFLAGS="-g -O0"
# Build
python setup.py build_ext --inplace
Release Build
For optimized production build:
Custom Compiler
Using Clang on Linux
Using Specific GCC Version
Development Builds
Install in Editable Mode
This allows you to make changes without reinstalling.
Rebuild After Changes
After modifying C++ or Cython code:
Python-only changes don't require rebuilding.
Build Artifacts
Generated Files
build/ # Build directory
rugo/parquet/metadata_reader.cpp # Generated from .pyx
rugo/parquet/*.so # Compiled extension (Linux)
rugo/parquet/*.dylib # Compiled extension (macOS)
rugo/parquet/*.pyd # Compiled extension (Windows)
Cleaning
Remove all build artifacts:
# Using Makefile
make clean
# Manual cleanup
rm -rf build/
rm -rf rugo.egg-info/
rm -rf rugo/parquet/*.so
rm -rf rugo/parquet/*.cpp
find . -name "__pycache__" -type d -exec rm -rf {} +
find . -name "*.pyc" -delete
Troubleshooting
Common Issues
Compiler Not Found
Error: error: command 'gcc' failed
Solution: Install build tools (see Prerequisites)
C++17 Not Supported
Error: error: unrecognized command line option '-std=c++17'
Solution: Update compiler to GCC 7+ or Clang 5+
Python.h Not Found
Error: fatal error: Python.h: No such file or directory
Solution:
Cython Import Error
Error: ModuleNotFoundError: No module named 'Cython'
Solution:
Platform-Specific Issues
macOS - Invalid Architecture
Error: Building for wrong architecture
Solution:
# For M1/M2 Macs
arch -arm64 python setup.py build_ext --inplace
# For Intel Macs
arch -x86_64 python setup.py build_ext --inplace
Windows - MSVC Not Found
Error: error: Microsoft Visual C++ 14.0 or greater is required
Solution: Install Visual Studio Build Tools
Linux - Missing Libraries
Error: Linking errors
Solution:
Verification
Test the Build
Check Extension
import rugo.parquet as parquet_meta
# Should work without errors
metadata = parquet_meta.read_metadata("test.parquet")
Verify Optimization
Check that extension was built with optimization:
Advanced Build Options
Custom Build Directory
Parallel Compilation
Verbose Build
Continuous Integration
Example GitHub Actions workflow:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install --upgrade pip
make update
- name: Compile
run: make compile
- name: Test
run: make test
Next Steps
- Contributing Guide - How to contribute
- Project Structure - Understand the codebase