Prerequisites
Before building m87, ensure you have the required tools installed.Required Tools
Rust 1.85 or newer
m87 requires Rust 1.85 or later. Install or update Rust using rustup:Expected output:
rustc 1.85.0 or higher.Quick Build
For most users, the standard build process is:target/release/m87.
Detailed Build Instructions
Build the project
Build the release version:This compiles m87 with full optimizations. The build process may take several minutes.
The
--release flag enables optimizations and produces a smaller, faster binary. Development builds (without --release) are faster to compile but slower to run.Build Options
Building Specific Components
The m87 workspace contains multiple packages. You can build specific components: Build only the CLI:Platform-Specific Builds
Build configuration is automatically detected based on your operating system:- Linux: Full functionality (CLI + runtime)
- macOS: CLI only (runtime not available)
The m87 runtime only runs on Linux. macOS builds include the CLI commands but exclude runtime functionality.
Development Build
For faster compilation during development:- Compile faster (~50% faster)
- Include debug symbols
- No optimizations (significantly slower at runtime)
- Located at
target/debug/m87
Build Configuration
The build is configured viaCargo.toml in the workspace root.
Release Profile Settings
The release profile is optimized for performance and minimal binary size:- Smaller binary size (~40-60% reduction)
- Better runtime performance
- Longer compilation time
- No debug symbols (use
strip = falseif needed)
Custom Build Profiles
Create a custom profile for specific needs:Cargo.toml:
Cross-Compilation
Build for different architectures using cross-compilation.Setup Cross-Compilation
Install the target architecture:Build for Target Architecture
Using cross for Easy Cross-Compilation
For easier cross-compilation, use thecross tool:
cross uses Docker to provide a complete cross-compilation environment, eliminating the need for target-specific system dependencies.Building with Docker
Build m87 inside a Docker container for a consistent environment.Optimizing Build Times
Use Cargo Cache
Cargo caches dependencies. Keep them updated:Parallel Compilation
Increase parallel jobs (default is number of CPU cores):Use sccache
Distributed compilation cache:Incremental Compilation
Enabled by default for dev builds, disabled for release. Enable for faster release builds:Verifying the Build
Development Workflow
For active development:Troubleshooting Build Issues
Rust version too old
Rust version too old
Error:
package requires rustc 1.85 or newerSolution:Missing system dependencies
Missing system dependencies
Error:
could not find native static librarySolution:
Install required system libraries:Linker errors
Linker errors
Error:
linking with 'cc' failedSolution:
Ensure you have a C compiler installed:Out of disk space
Out of disk space
Error:
No space left on deviceSolution:
Cargo builds can use significant disk space. Clean old builds:Slow compilation
Slow compilation
Problem: Build takes too long.Solutions:
- Use development build instead:
cargo build(no--release) - Enable incremental compilation
- Use
sccachefor caching - Increase parallel jobs:
cargo build -j 8
Next Steps
After building from source:- Install the binary: Copy to
~/.local/binor/usr/local/bin - Set up development environment: Run
m87 loginand connect a device - Contribute: Submit improvements via GitHub pull requests
Contributing
Contributions are welcome! Before submitting:The m87-client and m87-shared packages are licensed under Apache-2.0. The m87-server package is licensed under AGPL-3.0-or-later.