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

deps: simplify os dependencies #1496

Merged
merged 4 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 3 additions & 15 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev llvm\
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python libclang-6.0-dev clang ocl-icd-opencl-dev libgflags-dev libhwloc-dev
sudo apt-get install -y build-essential clang ocl-icd-opencl-dev
- name: Checkout Sources
uses: actions/checkout@v2
- name: Install Toolchain
Expand Down Expand Up @@ -60,11 +56,7 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev llvm\
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python libclang-6.0-dev clang ocl-icd-opencl-dev libgflags-dev libhwloc-dev
sudo apt-get install -y build-essential clang ocl-icd-opencl-dev
- name: Checkout Sources
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -142,11 +134,7 @@ jobs:
if: startsWith(matrix.os, 'Ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev llvm\
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python libclang-6.0-dev clang ocl-icd-opencl-dev libgflags-dev libhwloc-dev
sudo apt-get install -y build-essential clang ocl-icd-opencl-dev
- name: Checkout Sources
uses: actions/checkout@v2
- name: Install Toolchain
Expand Down
24 changes: 6 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,19 @@ FROM rust:1-buster AS build-env
WORKDIR /usr/src/forest
COPY . .

# Install protoc
ENV PROTOC_ZIP protoc-3.7.1-linux-x86_64.zip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIP
RUN unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
RUN unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
RUN rm -f $PROTOC_ZIP

# Extra dependencies needed for rust-fil-proofs
RUN apt-get update && \
apt-get install --no-install-recommends -y curl file gcc g++ hwloc libhwloc-dev git make openssh-client \
ca-certificates autoconf automake cmake libtool libcurl4 libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev
# Install dependencies
RUN apt-get update
RUN apt-get install --no-install-recommends -y build-essential clang ocl-icd-opencl-dev

# Install Forest
RUN cargo install --path forest

# Prod image for forest binary
FROM debian:buster-slim

# Install binary dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y curl file gcc g++ hwloc libhwloc-dev make openssh-client \
autoconf automake cmake libtool libcurl4 libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev ca-certificates
RUN apt-get update
RUN apt-get install --no-install-recommends -y build-essential clang ocl-icd-opencl-dev

# Copy over binaries from the build-env
COPY --from=build-env /usr/local/cargo/bin/forest /usr/local/bin/forest
Expand Down
16 changes: 3 additions & 13 deletions Dockerfile-ci
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,9 @@ FROM rust:1-buster
WORKDIR /usr/src/forest
COPY . .

# Install protoc
ENV PROTOC_ZIP protoc-3.7.1-linux-x86_64.zip
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIP
RUN unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
RUN unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
RUN rm -f $PROTOC_ZIP

# Extra dependencies needed for rust-fil-proofs
RUN apt-get update && \
apt-get install -y curl file gcc g++ git make openssh-client \
autoconf automake cmake libtool libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev
# Install dependencies
RUN apt-get update
RUN apt-get install --no-install-recommends -y build-essential clang ocl-icd-opencl-dev

RUN bash -l -c 'echo $(rustc --print sysroot)/lib >> /etc/ld.so.conf'
RUN bash -l -c 'echo /usr/local/lib >> /etc/ld.so.conf'
Expand Down
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,33 @@ Our crates:


## Dependencies
`rustc >= 1.58.1`

## Usage
* Rust `rustc >= 1.58.1`
* Rust WASM target `wasm32-unknown-unknown`

```shell
rustup install stable
rustup target add wasm32-unknown-unknown
```

* OS Base-Devel/Build-Essential
* Clang compiler
* OpenCL bindings

```shell
# Ubuntu
sudo apt install build-essential clang ocl-icd-opencl-dev

# Archlinux
sudo pacman -S base-devel clang ocl-icd
```

## Installation
```shell
# Clone repository
git clone --recursive https://github.com/chainsafe/forest
cd forest

# Install wasm32 target
rustup target add wasm32-unknown-unknown

# Install binary to $HOME/.cargo/bin and run node
make install
forest
Expand All @@ -53,8 +69,6 @@ git checkout $TAG
cargo build --release --bin forest --features release
```

> `OpenCL`, `hwloc` and a compatible assembly linker (ex. `clang`) are also required to build Filecoin proofs.

### Config

Run the node with custom config and bootnodes
Expand Down
41 changes: 16 additions & 25 deletions documentation/src/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,26 @@

## Build

### Toolchain
### Dependencies

- [Rust](https://www.rust-lang.org/tools/install)
* Rust `rustc >= 1.58.1`
* Rust WASM target `wasm32-unknown-unknown`

### Dependencies
```shell
rustup install stable
rustup target add wasm32-unknown-unknown
```

The following commands will install the required dependencies for Forest:
* OS Base-Devel/Build-Essential
* Clang compiler
* OpenCL bindings

```bash
# Install protoc
PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIP
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP

# Extra dependencies needed for rust-fil-proofs
apt-get update && \
apt-get install --no-install-recommends -y curl file gcc g++ hwloc libhwloc-dev git make openssh-client \
ca-certificates autoconf automake cmake libtool libcurl4 libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev

# Install binary dependencies
apt-get update && \
apt-get install --no-install-recommends -y curl file gcc g++ hwloc libhwloc-dev make openssh-client \
autoconf automake cmake libtool libcurl4 libcurl4-openssl-dev libssl-dev \
libelf-dev libdw-dev binutils-dev zlib1g-dev libiberty-dev wget \
xz-utils pkg-config python clang ocl-icd-opencl-dev ca-certificates
```shell
# Ubuntu
sudo apt install build-essential clang ocl-icd-opencl-dev

# Archlinux
sudo pacman -S base-devel clang ocl-icd
```

### Commands
Expand Down