Skip to main content
Building m87 from source gives you the latest development features and allows you to customize the build for your specific needs.

Prerequisites

Before building m87, ensure you have the required tools installed.

Required Tools

1

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.
2

Git

Git is required to clone the repository:
3

System Dependencies

Install system dependencies required for compilation:Debian/Ubuntu:
Fedora/RHEL:
macOS:

Quick Build

For most users, the standard build process is:
The compiled binary will be at target/release/m87.

Detailed Build Instructions

1

Clone the repository

Clone the m87 repository from GitHub:
To build a specific version:
2

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.
3

Locate the binary

After compilation, the binary is located at:
4

Install the binary

Copy the binary to a directory in your PATH:
Ensure ~/.local/bin is in your PATH. Add to your shell profile if needed:

Build Options

Building Specific Components

The m87 workspace contains multiple packages. You can build specific components: Build only the CLI:
Build only shared libraries:
Build server components (AGPL license):

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:
Development builds:
  • Compile faster (~50% faster)
  • Include debug symbols
  • No optimizations (significantly slower at runtime)
  • Located at target/debug/m87
Development builds are not suitable for production use due to reduced performance.

Build Configuration

The build is configured via Cargo.toml in the workspace root.

Release Profile Settings

The release profile is optimized for performance and minimal binary size:
These settings produce:
  • Smaller binary size (~40-60% reduction)
  • Better runtime performance
  • Longer compilation time
  • No debug symbols (use strip = false if needed)

Custom Build Profiles

Create a custom profile for specific needs:
Add to 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 the cross 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.
1

Build the Docker image

2

Run m87 from the container

3

Create a shell alias

Add to your ~/.bashrc or ~/.zshrc:
Now use m87 as usual:

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:
Incremental compilation may produce slightly larger binaries.

Verifying the Build

1

Check binary size

Expected size: 10-30 MB depending on platform and optimization.
2

Run basic commands

3

Test authentication

4

Compare with official binary

Compare behavior with the official release to ensure consistency.

Development Workflow

For active development:

Troubleshooting Build Issues

Error: package requires rustc 1.85 or newerSolution:
Error: could not find native static librarySolution: Install required system libraries:
Error: linking with 'cc' failedSolution: Ensure you have a C compiler installed:
Error: No space left on deviceSolution: Cargo builds can use significant disk space. Clean old builds:
Problem: Build takes too long.Solutions:
  • Use development build instead: cargo build (no --release)
  • Enable incremental compilation
  • Use sccache for caching
  • Increase parallel jobs: cargo build -j 8

Next Steps

After building from source:
  1. Install the binary: Copy to ~/.local/bin or /usr/local/bin
  2. Set up development environment: Run m87 login and connect a device
  3. Contribute: Submit improvements via GitHub pull requests

Contributing

Contributions are welcome! Before submitting:
See the Contributing Guide for more details.
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.