Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation how to build nitro locally, add instructions for MacOS #617

Merged
merged 13 commits into from
Sep 26, 2023
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 83 additions & 22 deletions arbitrum-docs/node-running/how-tos/build-nitro-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,38 @@ import PublicPreviewBannerPartial from '../../partials/_public-preview-banner-pa

<PublicPreviewBannerPartial />

This how-to is based on [Debian 11.7 (arm64)](https://cdimage.debian.org/cdimage/archive/11.7.0/arm64/iso-cd/debian-11.7.0-arm64-netinst.iso) and [Ubuntu 22.04 (amd64)](https://releases.ubuntu.com/22.04.2/ubuntu-22.04.2-desktop-amd64.iso).
This how-to is based on [Debian 11.7 (arm64)](https://cdimage.debian.org/cdimage/archive/11.7.0/arm64/iso-cd/debian-11.7.0-arm64-netinst.iso) / [Ubuntu 22.04 (amd64)](https://releases.ubuntu.com/22.04.2/ubuntu-22.04.2-desktop-amd64.iso), and [MacOS Ventura 13.4](https://developer.apple.com/documentation/macos-release-notes/macos-13_4-release-notes).
symbolpunk marked this conversation as resolved.
Show resolved Hide resolved

### 1. Configure prerequisites

#### For Debian/Ubuntu

```bash
apt install git curl build-essential cmake npm golang clang make gotestsum wabt lld-13
npm install --global yarn
ln -s /usr/bin/wasm-ld-13 /usr/local/bin/wasm-ld
```

#### For MacOS

Install [Homebrew](https://brew.sh/) package manager and add it to your path environment variable.
symbolpunk marked this conversation as resolved.
Show resolved Hide resolved

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.zprofile && source ~/.zprofile
```

(replace `~/.zprofile` with `~/.bash_profile` if you use bash instead of zsh).

Install essentials:

```bash
brew install git curl make cmake npm go gvm golangci-lint wabt llvm gotestsum
npm install --global yarn
sudo mkdir -p /usr/local/bin
sudo ln -s /opt/homebrew/opt/llvm/bin/wasm-ld /usr/local/bin/wasm-ld
```

### 2. Configure Nitro

```bash
Expand All @@ -30,54 +52,93 @@ git submodule update --init --recursive --force

### 3. Configure Node [16.19](https://github.com/nvm-sh/nvm)

#### For Debian/Ubuntu

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source "$HOME/.bashrc"
nvm install 16.19
nvm use 16.19
```

### 4. Configure Rust [1.66.1](https://www.rust-lang.org/tools/install)
#### For MacOS

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 16.19
nvm use 16.19
```

### 4. Configure Rust [1.72.1](https://www.rust-lang.org/tools/install)

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
rustup install 1.66.1
rustup default 1.66.1
rustup target add wasm32-unknown-unknown --toolchain 1.66.1
rustup target add wasm32-wasi --toolchain 1.66.1
rustup install 1.72.1
rustup default 1.72.1
rustup target add wasm32-unknown-unknown --toolchain 1.72.1
rustup target add wasm32-wasi --toolchain 1.72.1
cargo install cbindgen
```

### 5. Configure [Docker](https://docs.docker.com/engine/install/debian/)
### 5. Configure [Docker](https://docs.docker.com/engine/install)

#### For [Debian](https://docs.docker.com/engine/install/debian)/[Ubuntu](https://docs.docker.com/engine/install/ubuntu)

```bash
apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get install ca-certificates curl gnupg
mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
service docker start
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo service docker start
```

### 6. Configure Go [1.19.5](https://github.com/moovweb/gvm)
#### For [MacOS](https://docs.docker.com/desktop/install/mac-install/)

Depending on whether your Mac has Intel Chip or Apple silicon, download corresponding
symbolpunk marked this conversation as resolved.
Show resolved Hide resolved
disk image from [docker](https://docs.docker.com/desktop/install/mac-install/), and move it to applications folder.
symbolpunk marked this conversation as resolved.
Show resolved Hide resolved

### 6. Configure Go [1.20](https://github.com/moovweb/gvm)

#### Install Bison

##### For Debian/Ubuntu

```bash
sudo apt-get install bison
```

##### For MacOS

```bash
brew install bison
```

#### Install and configure Go

```bash
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source "$HOME/.gvm/scripts/gvm"
apt-get install bison
gvm install go1.19.5
gvm use 1.19.5 --default
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
gvm install go1.20
gvm use go1.20 --default
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
```

If you use zsh, replace `bash` with `zsh`.

### 7. Start build

```bash
Expand Down