Update Lighthouse book and some FAQs (#4178)

## Issue Addressed

Updated Lighthouse book on Section 2 and added some FAQs

## Proposed Changes

All changes are made in the book/src .md files.

## Additional Info

Please provide any additional information. For example, future considerations
or information useful for reviewers.


Co-authored-by: chonghe <tanck2005@gmail.com>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
chonghe
2023-04-14 01:11:45 +00:00
parent a3669abac5
commit 56dba96319
8 changed files with 149 additions and 88 deletions

View File

@@ -5,8 +5,20 @@ the instructions below, and then proceed to [Building Lighthouse](#build-lightho
## Dependencies
First, **install Rust** using [rustup](https://rustup.rs/). The rustup installer provides an easy way
to update the Rust compiler, and works on all platforms.
First, **install Rust** using [rustup](https://rustup.rs/)
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
The rustup installer provides an easy way to update the Rust compiler, and works on all platforms.
> Tips:
>
> - During installation, when prompted, enter `1` for the default installation.
> - After Rust installation completes, try running `cargo version` . If it cannot
> be found, run `source $HOME/.cargo/env`. After that, running `cargo version` should return the version, for example `cargo 1.68.2`.
> - It's generally advisable to append `source $HOME/.cargo/env` to `~/.bashrc`.
With Rust installed, follow the instructions below to install dependencies relevant to your
operating system.
@@ -19,10 +31,17 @@ Install the following packages:
sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang protobuf-compiler
```
> Tips:
>
> - If there are difficulties, try updating the package manager with `sudo apt
> update`.
> 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/](https://apt.kitware.com)
After this, you are ready to [build Lighthouse](#build-lighthouse).
#### macOS
1. Install the [Homebrew][] package manager.
@@ -39,10 +58,19 @@ brew install protobuf
[Homebrew]: https://brew.sh/
After this, you are ready to [build Lighthouse](#build-lighthouse).
#### Windows
1. Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
1. Install [Git](https://git-scm.com/download/win).
1. Install the [Chocolatey](https://chocolatey.org/install) package manager for Windows.
> Tips:
> - Use PowerShell to install. In Windows, search for PowerShell and run as administrator.
> - You must ensure `Get-ExecutionPolicy` is not Restricted. To test this, run `Get-ExecutionPolicy` in PowerShell. If it returns `restricted`, then run `Set-ExecutionPolicy AllSigned`, and then run
```bash
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
```
> - To verify that Chocolatey is ready, run `choco` and it should return the version.
1. Install Make, CMake, LLVM and protoc using Chocolatey:
```
@@ -67,6 +95,8 @@ should follow the instructions for Ubuntu listed in the [Dependencies (Ubuntu)](
[WSL]: https://docs.microsoft.com/en-us/windows/wsl/about
After this, you are ready to [build Lighthouse](#build-lighthouse).
## Build Lighthouse
Once you have Rust and the build dependencies you're ready to build Lighthouse:
@@ -136,7 +166,7 @@ Commonly used features include:
* `spec-minimal`: support for the minimal preset (useful for testing).
Default features (e.g. `slasher-mdbx`) may be opted out of using the `--no-default-features`
argument for `cargo`, which can plumbed in via the `CARGO_INSTALL_EXTRA_FLAGS` environment variable.
argument for `cargo`, which can be plumbed in via the `CARGO_INSTALL_EXTRA_FLAGS` environment variable.
E.g.
```
@@ -171,12 +201,11 @@ PROFILE=maxperf make
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)](https://www.rust-lang.org/tools/install) for more information.
See ["Configuring the `PATH` environment variable"](https://www.rust-lang.org/tools/install) 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`.
Make sure you are running the latest version of Rust. If you have installed Rust using rustup, simply run `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
@@ -185,7 +214,7 @@ Rust Version (MSRV) which is listed under the `rust-version` key in Lighthouse's
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](./cross-compiling.md), or use a [pre-built
binary](./installation-binaries.md).
binary](https://github.com/sigp/lighthouse/releases).
If compilation fails with `error: linking with cc failed: exit code: 1`, try running `cargo clean`.