From a76b142e65a17da6bdf7ed574db3458b95a9893c Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Sun, 5 Mar 2023 19:07:16 +0000 Subject: [PATCH] Update install guide --- INSTALL.md | 71 +++++++++++++++++++++++++++++++++++++++++------------- README.md | 2 ++ 2 files changed, 56 insertions(+), 17 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index cf06417..d2f99cb 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,13 +1,27 @@ +## Building with Nix + +The recommended and most stable way to build Radiance is with [Nix](https://nixos.org/). +This requires an existing Nix installation on your machine. + + nix-build + ./result/bin/radiance --help + +However, note that the resulting binary will only run under the same Nix environment. + ## Building with Go -Radiance commands can be built with standard Go tooling (Go >= 1.19 is required), -for example: +Radiance commands can be built with standard Go 1.19 tooling. - go run go.firedancer.io/radiance/cmd/radiance + go run ./cmd/radiance -By default, commands that require extra dependencies (e.g. RocksDB) are disabled. +### Without Cgo -### With RocksDB +The full set of functionality requires C dependencies via Cgo. +To create a pure-Go build use the `lite` tag. + + go build -tags=lite ./cmd/radiance + +### With Cgo dependencies Radiance tools that require direct access to the blockstore (such as `blockstore` and `car`) require a working C toolchain and extra compiler arguments to link against rocksdb. @@ -16,23 +30,46 @@ You'll need a working C compiler toolchain as well as prerequisites listed by [grocksdb](https://github.com/linxGnu/grocksdb#prerequisite) and [RocksDB itself](https://github.com/linxGnu/grocksdb#prerequisite). -For RHEL/Centos/Fedora: +**RHEL/Centos/Fedora** - dnf -y install "@Development Tools" gflags-devel snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel + dnf -y install "@Development Tools" cmake zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel -First, check out the rocksdb submodule: +**Debian** - git submodule update --init + # With package manager RocksDB + apt install -y librocksdb-dev -Then, build the rocksdb C library: + # With RocksDB from source + apt install -y build-essential cmake zlib1g-dev libbz2-dev liblz4-dev libzstd-dev - cd third_party/rocksdb - make -j $(nproc) static_lib - cd - +**Building RocksDB** -Finally, build the `radiance` command with the `rocksdb` tag: +To build RocksDB from source, run the following commands: - export CGO_CFLAGS="-I$(pwd)/third_party/rocksdb/include" - export CGO_LDFLAGS="-L$(pwd)/third_party/rocksdb" + git clone https://github.com/facebook/rocksdb --branch v7.10.2 --depth 1 + cd rocksdb + mkdir -p build && cd build + cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DROCKSDB_BUILD_SHARED=OFF \ + -DWITH_GFLAGS=OFF \ + -DWITH_BZ2=ON \ + -DWITH_SNAPPY=OFF \ + -DWITH_ZLIB=ON \ + -DWITH_ZSTD=ON \ + -DWITH_ALL_TESTS=OFF \ + -DWITH_BENCHMARK_TOOLS=OFF \ + -DWITH_CORE_TOOLS=OFF \ + -DWITH_RUNTIME_DEBUG=OFF \ + -DWITH_TESTS=OFF \ + -DWITH_TOOLS=OFF \ + -DWITH_TRACE_TOOLS=OFF + make -j + cd ../.. - go run -tags=rocksdb go.firedancer.io/radiance/cmd/radiance +Finally, rebuild RocksDB with the appropriate Cgo flags. + + export CGO_CFLAGS="-I$(pwd)/rocksdb/include" + export CGO_LDFLAGS="-L$(pwd)/rocksdb/build" + + go run ./cmd/radiance diff --git a/README.md b/README.md index 9a599a2..883ff25 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,5 @@ Assortment of Solana protocol modules written in Go. Check back later unless you're ready to read and understand the code. ⚠️ [![Go Reference](https://pkg.go.dev/badge/go.firedancer.io/radiance.svg)](https://pkg.go.dev/go.firedancer.io/radiance) + +[Installation Guide](./INSTALL.md)