4.4 KiB
Building RLogg
This document describes how to build RLogg for different platforms.
Quick Start
On Linux, you can build for all platforms including Windows:
./cross-compile.sh all
This uses Docker-based cross-compilation, so no Windows tools needed!
Prerequisites
- Rust toolchain (install from https://rustup.rs/)
- Platform-specific dependencies (see below)
- For cross-compilation: Docker (for the
crosstool)
Platform-Specific Dependencies
Linux
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev \
libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
macOS
No additional dependencies required. Xcode Command Line Tools should be installed.
Windows
No additional dependencies required. Visual Studio Build Tools or Visual Studio with C++ development tools should be installed.
Quick Build
Development Build
cargo build
Release Build (Optimized)
cargo build --release
The binary will be in target/release/rlogg (or rlogg.exe on Windows).
Multi-Platform Builds
Using Build Scripts
Linux/macOS
./build-release.sh
Windows
.\build-release.ps1
The built binaries will be in the dist/ directory.
Manual Cross-Compilation
Install Target
# For Linux
rustup target add x86_64-unknown-linux-gnu
# For Windows
rustup target add x86_64-pc-windows-msvc
# For macOS x86_64
rustup target add x86_64-apple-darwin
# For macOS ARM (M1/M2)
rustup target add aarch64-apple-darwin
Build for Specific Target
cargo build --release --target <target-triple>
Examples:
# Linux
cargo build --release --target x86_64-unknown-linux-gnu
# Windows
cargo build --release --target x86_64-pc-windows-msvc
# macOS Intel
cargo build --release --target x86_64-apple-darwin
# macOS Apple Silicon
cargo build --release --target aarch64-apple-darwin
GitHub Actions (Automated Builds)
The project includes GitHub Actions workflow that automatically builds for all platforms:
- Linux x86_64
- Windows x86_64
- macOS x86_64 (Intel)
- macOS aarch64 (Apple Silicon)
Triggering Builds
- Push to master/main: Builds all platforms and uploads artifacts
- Pull Request: Runs build checks
- Release: Builds and attaches binaries to the GitHub release
Creating a Release
-
Tag your commit:
git tag -a v0.1.0 -m "Release v0.1.0" git push origin v0.1.0 -
Create a release on GitHub from the tag
-
GitHub Actions will automatically build and attach binaries
Optimizing Binary Size
To reduce the binary size, you can use these settings in Cargo.toml:
[profile.release]
opt-level = "z" # Optimize for size
lto = true # Enable Link Time Optimization
codegen-units = 1 # Better optimization
strip = true # Strip symbols
Or build with:
cargo build --release
strip target/release/rlogg # On Linux/macOS
Troubleshooting
Linux: Missing libraries
Make sure all required development libraries are installed:
sudo apt-get install -y libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev \
libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
macOS: Code signing issues
If you encounter code signing errors, you can sign the binary:
codesign --force --deep --sign - target/release/rlogg
Windows: MSVC not found
Install Visual Studio Build Tools with C++ development tools, or install full Visual Studio.
Cross-compilation from Linux to Windows
Method 1: Using the cross-compile script (Recommended)
# Interactive mode
./cross-compile.sh
# Or specify target directly
./cross-compile.sh windows # Windows (MinGW)
./cross-compile.sh all # All platforms
Note: Only MinGW/GNU target is supported for cross-compilation from Linux. MSVC requires Windows.
Method 2: Manual with 'cross'
Install cross and build:
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target x86_64-pc-windows-msvc
The cross tool uses Docker to provide a complete cross-compilation environment, so you don't need to install Windows-specific tools.
Running Tests
cargo test
Running in Development Mode
cargo run
Checking Code
# Check for errors without building
cargo check
# Run linter
cargo clippy
# Format code
cargo fmt