radiance/INSTALL.md

76 lines
2.1 KiB
Markdown
Raw Normal View History

2023-03-05 11:07:16 -08:00
## 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
2023-03-05 11:07:16 -08:00
Radiance commands can be built with standard Go 1.19 tooling.
2023-03-05 11:07:16 -08:00
go run ./cmd/radiance
2023-03-05 11:07:16 -08:00
### Without Cgo
2023-03-05 11:07:16 -08:00
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.
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).
2023-03-05 11:07:16 -08:00
**RHEL/Centos/Fedora**
dnf -y install "@Development Tools" cmake zlib zlib-devel bzip2 bzip2-devel lz4-devel libzstd-devel
**Debian**
2023-03-05 11:07:16 -08:00
# With package manager RocksDB
apt install -y librocksdb-dev
2023-03-05 11:07:16 -08:00
# With RocksDB from source
apt install -y build-essential cmake zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
2023-03-05 11:07:16 -08:00
**Building RocksDB**
2023-03-05 11:07:16 -08:00
To build RocksDB from source, run the following commands:
2023-03-05 11:07:16 -08:00
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 ../..
2023-03-05 11:07:16 -08:00
Finally, rebuild RocksDB with the appropriate Cgo flags.
2023-03-05 11:07:16 -08:00
export CGO_CFLAGS="-I$(pwd)/rocksdb/include"
export CGO_LDFLAGS="-L$(pwd)/rocksdb/build"
2023-03-05 11:07:16 -08:00
go run ./cmd/radiance