Files
lighthouse/book/src/installation-source.md
Michael Sproul 44a106a8af Switch allocator to jemalloc (#3697)
Squashed commit of the following:

commit 974b3359f8
Merge: ac205b7ba 480309fb9
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Wed Jan 18 10:01:26 2023 +1100

    Merge remote-tracking branch 'origin/unstable' into jemalloc

commit 480309fb96
Author: aliask <aliask@gmail.com>
Date:   Tue Jan 17 05:13:49 2023 +0000

    Fix some dead links in markdown files (#3885)

    ## Issue Addressed

    No issue has been raised for these broken links.

    ## Proposed Changes

    Update links with the new URLs for the same document.

    ## Additional Info

    ~The link for the [Lighthouse Development Updates](https://eepurl.com/dh9Lvb/) mailing list is also broken, but I can't find the correct link.~

    Co-authored-by: Paul Hauner <paul@paulhauner.com>

commit b4d9fc03ee
Author: GeemoCandama <geemo@tutanota.com>
Date:   Tue Jan 17 05:13:48 2023 +0000

    add logging for starting request  and receiving block (#3858)

    ## Issue Addressed

    #3853

    ## Proposed Changes

    Added `INFO` level logs for requesting and receiving the unsigned block.

    ## Additional Info

    Logging for successfully publishing the signed block is already there. And seemingly there is a log for when "We realize we are going to produce a block" in the `start_update_service`: `info!(log, "Block production service started");
    `.  Is there anywhere else you'd like to see logging around this event?

    Co-authored-by: GeemoCandama <104614073+GeemoCandama@users.noreply.github.com>

commit 9a970ce3a2
Author: David Theodore <prodigalsonsolutions@gmail.com>
Date:   Tue Jan 17 05:13:47 2023 +0000

    add better err reporting UnableToOpenVotingKeystore (#3781)

    ## Issue Addressed

    #3780

    ## Proposed Changes

    Add error reporting that notifies the node operator that the `voting_keystore_path` in their `validator_definitions.yml` file may be incorrect.

    ## Additional Info

    There is more info in issue #3780

    Co-authored-by: Paul Hauner <paul@paulhauner.com>

commit ac205b7bab
Merge: 93457d85b bf533c8e4
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Fri Nov 25 16:32:33 2022 +1100

    Merge remote-tracking branch 'origin/unstable' into jemalloc

commit 93457d85b7
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Wed Nov 9 11:53:59 2022 +1100

    Fix cargo-udeps

commit 6c42aef1b5
Author: Michael Sproul <micsproul@gmail.com>
Date:   Tue Nov 8 19:12:19 2022 +1100

    Fixups

commit f14b87bb88
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Nov 8 16:28:16 2022 +1100

    Update docs

commit 5005dc3b65
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Nov 8 16:22:42 2022 +1100

    Fix lcli

commit a082ba5904
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Tue Nov 8 16:17:10 2022 +1100

    Remove check-consensus

commit 81441e9cea
Author: Michael Sproul <micsproul@gmail.com>
Date:   Tue Nov 8 15:28:11 2022 +1100

    Disable jemalloc on Windows

commit 41eac5d0c1
Author: Michael Sproul <micsproul@gmail.com>
Date:   Tue Nov 8 13:46:17 2022 +1100

    Compatibility with macOS

commit 69ecba7876
Author: Michael Sproul <michael@sigmaprime.io>
Date:   Mon Nov 7 18:48:31 2022 +1100

    Add jemalloc support
2023-01-18 10:07:21 +11:00

5.1 KiB

Build from Source

Lighthouse builds on Linux, macOS, and Windows. Install the Dependencies using the instructions below, and then proceed to Building Lighthouse.

Dependencies

First, install Rust using rustup. The rustup installer provides an easy way to update the Rust compiler, and works on all platforms.

With Rust installed, follow the instructions below to install dependencies relevant to your operating system.

Ubuntu

Install the following packages:

sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang protobuf-compiler

Note: Lighthouse requires CMake v3.12 or newer, which isn't available in the package repositories of Ubuntu 18.04 or earlier. On these distributions CMake can still be installed via PPA: https://apt.kitware.com/

macOS

  1. Install the Homebrew package manager.
  2. Install CMake using Homebrew:
brew install cmake
  1. Install protoc using Homebrew:
brew install protobuf

Windows

  1. Install Git.
  2. Install the Chocolatey package manager for Windows.
  3. Install Make, CMake, LLVM and protoc using Chocolatey:
choco install make
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
choco install llvm
choco install protoc

These dependencies are for compiling Lighthouse natively on Windows. Lighthouse can also run successfully under the Windows Subsystem for Linux (WSL). If using Ubuntu under WSL, you should follow the instructions for Ubuntu listed in the Dependencies (Ubuntu) section.

Build Lighthouse

Once you have Rust and the build dependencies you're ready to build Lighthouse:

git clone https://github.com/sigp/lighthouse.git
cd lighthouse
git checkout stable
make

Compilation may take around 10 minutes. Installation was successful if lighthouse --help displays the command-line documentation.

If you run into any issues, please check the Troubleshooting section, or reach out to us on Discord.

Update Lighthouse

You can update Lighthouse to a specific version by running the commands below. The lighthouse directory will be the location you cloned Lighthouse to during the installation process. ${VERSION} will be the version you wish to build in the format vX.X.X.

cd lighthouse
git fetch
git checkout ${VERSION}
make

Feature Flags

You can customise the features that Lighthouse is built with using the FEATURES environment variable. E.g.

FEATURES=gnosis,slasher-lmdb make

Commonly used features include:

  • gnosis: support for the Gnosis Beacon Chain.
  • portable: support for legacy hardware.
  • modern: support for exclusively modern hardware.
  • slasher-mdbx: support for the MDBX slasher backend. Enabled by default.
  • slasher-lmdb: support for the LMDB slasher backend.
  • jemalloc: use jemalloc to allocate memory. Enabled by default on Linux and macOS. Not supported on Windows.

Compilation Profiles

You can customise the compiler settings used to compile Lighthouse via Cargo profiles.

Lighthouse includes several profiles which can be selected via the PROFILE environment variable.

  • release: default for source builds, enables most optimisations while not taking too long to compile.
  • maxperf: default for binary releases, enables aggressive optimisations including full LTO. Although compiling with this profile improves some benchmarks by around 20% compared to release, it imposes a significant cost at compile time and is only recommended if you have a fast CPU.

To compile with maxperf:

PROFILE=maxperf make

Troubleshooting

Command is not found

Lighthouse will be installed to CARGO_HOME or $HOME/.cargo. This directory needs to be on your PATH before you can run $ lighthouse.

See "Configuring the PATH environment variable" (rust-lang.org) for more information.

Compilation error

Make sure you are running the latest version of Rust. If you have installed Rust using rustup, simply type rustup update.

If you can't install the latest version of Rust you can instead compile using the Minimum Supported Rust Version (MSRV) which is listed under the rust-version key in Lighthouse's Cargo.toml.

If compilation fails with (signal: 9, SIGKILL: kill), this could mean your machine ran out of memory during compilation. If you are on a resource-constrained device you can look into cross compilation, or use a pre-built binary.

If compilation fails with error: linking with cc failed: exit code: 1, try running cargo clean.