Skip to content

Latest commit

 

History

History
151 lines (108 loc) · 4.18 KB

BUILD.md

File metadata and controls

151 lines (108 loc) · 4.18 KB

Building Rerun

This is a guide to how to build Rerun.

See also

Getting started with the repository.

  • Install the Rust toolchain: https://rustup.rs/
  • git clone [email protected]:rerun-io/rerun.git && cd rerun
  • Run ./scripts/setup_dev.sh.
  • Make sure cargo --version prints 1.67.0 once you are done

Apple-silicon Macs

If you are using an Apple-silicon Mac (M1, M2), make sure rustc -vV outputs host: aarch64-apple-darwin. If not, this should fix it:

rustup set default-host aarch64-apple-darwin && rustup install 1.67

Building the docs

High-level documentation for rerun can be found at http://rerun.io/docs. It is built from the separate repository rerun-docs.

Python API docs can be found at https://ref.rerun.io/docs/python and are built via mkdocs and hosted on GitHub. For details on the python doc-system, see Writing Docs.

Rust documentation is hosted on https://docs.rs/rerun/. You can build them locally with: cargo doc --all-features --no-deps --open

Build and install the Rerun Python SDK

Rerun is available as a package on PyPi and can be installed with pip install rerun-sdk

Additionally, prebuilt dev wheels from head of main are available at https://github.com/rerun-io/rerun/releases/tag/latest.

However, if you want to build from source you can follow the instructions below.

Set up virtualenv

Mac/Linux:

python3 -m venv venv  # Rerun supports Python version >= 3.7
source venv/bin/activate
python -m pip install --upgrade pip  # We need pip version >=21.3

Windows (powershell):

python -m venv venv
.\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip

From here on out, we assume you have this virtualenv activated.

Build and install

You need to setup your build environment once with

./scripts/setup.sh

Then install the Rerun SDK with:

pip install ./rerun_py

Note: If you are unable to upgrade pip to version >=21.3, you need to pass --use-feature=in-tree-build to the pip install command.

Improving compile times

As of today, we link everything statically in both debug and release builds, which makes custom linkers and split debuginfo the two most impactful tools we have at our disposal in order to improve compile times.

These tools can configured through your Cargo configuration, available at $HOME/.cargo/config.toml.

macOS

On x64 macOS, use the zld linker and keep debuginfo in a single separate file.

Pre-requisites:

  • Install zld: brew install michaeleisel/zld/zld.

config.toml (x64):

[target.x86_64-apple-darwin]
rustflags = [
    "-C",
    "link-arg=-fuse-ld=/usr/local/bin/zld",
    "-C",
    "split-debuginfo=packed",
]

On Apple-silicon Mac (M1, M2), the default settings are already pretty good. The default linker is just as good as zld. Do NOT set split-debuginfo=packed, as that will make linking a lot slower. You can set split-debuginfo=unpacked for a small improvement.

config.toml (M1, M2):

[target.aarch64-apple-darwin]
rustflags = [
    "-C",
    "split-debuginfo=unpacked",
]

Linux

On Linux, use the mold linker and keep DWARF debuginfo in separate files.

Pre-requisites:

  • Install mold through your package manager.

config.toml:

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
    "-C",
    "link-arg=-fuse-ld=/usr/bin/mold",
    "-C",
    "split-debuginfo=unpacked",
]

Windows

On Windows, use LLVM's lld linker and keep debuginfo in a single separate file.

Pre-requisites:

  • Install lld:
cargo install -f cargo-binutils
rustup component add llvm-tools-preview

config.toml:

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
rustflags = [
    "-C",
    "split-debuginfo=packed",
]