Skip to content

Latest commit

 

History

History
155 lines (109 loc) · 4.02 KB

get-ckb.md

File metadata and controls

155 lines (109 loc) · 4.02 KB

Get CKB

We have CI to ensure CKB works in following systems, they are also the recommended system to run CKB.

OS Arch
Ubuntu 16.04 x64
macOS x64
Windows* x64

* Support for Windows is experimental. CKB is known to have serious performance issues when running in Windows.

CKB should also work on any modern Linux distributions. However, we limit our energy to focus on the support of following systems:

OS Arch
Ubuntu 18.04 x64
Debian Stretch x64
Arch Linux x64
CentOS 7 x64

You can also use docker if your operating system is not properly supported by CKB for now.

Download from Releases

We will publish binaries for each release via Github Releases. If your system is listed there, you can download the package directly.

CKB releases are signed. It is wise and more secure to check out for their integrity.

CentOS users please use the x86_64-unknown-centos-gnu package, which also requires OpenSSL 1.0 to run:

sudo yum install openssl-libs

The Windows packages are for experiments only, they have significant performance issues, we don't recommend to use them in production environment. They requires The Visual C++ Redistributable Packages, which can be downloaded under section Other Tools and Frameworks here or here.

Build from Source

Install Build Dependencies

CKB requires Rust to build. We recommend installing rustup to manage Rust versions.

The required Rust version is saved in the file rust-toolchain. If rustup is available, it will pick the right version automatically.

You also need to get the following packages:

Ubuntu and Debian

sudo apt-get install -y git gcc libc6-dev pkg-config libssl-dev libclang-dev clang

Arch Linux

sudo pacman -Sy git gcc pkgconf clang

macOS

brew install autoconf libtool

CentOS

sudo yum install -y centos-release-scl
sudo yum install -y git make gcc-c++ openssl-devel llvm-toolset-7

Start a shell enabling clang

scl enable llvm-toolset-7 bash

Remember to run following commands in this console.

Windows

Install Visual Studio with Desktop C++ workload, and install following packages via Chocolatey

choco install -y llvm msys2

Add Environment Variables

If your OS contains pre-compiled rocksdb or snappy libraries, you may setup ROCKSDB_LIB_DIR and/or SNAPPY_LIB_DIR environment variable to point to a directory with these libraries. This will significantly reduce compile time.

export ROCKSDB_LIB_DIR=/usr/local/lib
export SNAPPY_LIB_DIR=/usr/local/lib

Build from source

The master branch is regularly built and tested. It is always the latest released version. The default checked out branch develop is the latest version in active development.

It is recommended to build a version from master.

You can download the source code of master branch from GitHub, or a history version from GitHub Releases.

You also can choose to clone the code via git:

# get ckb source code
git clone https://github.com/nervosnetwork/ckb.git
cd ckb
git checkout master

It is easy to switch to a history version and build, for example, check out v0.12.2.

git checkout -b branch-v0.12.2 v0.12.2

Run make prod inside the source code directory. It will build the executable target/release/ckb. Please add the directory to PATH or copy/link the file into a directory already in the PATH.

export PATH="$(pwd)/target/release:$PATH"
# or
# ln -snf "$(pwd)/target/release/ckb" /usr/local/bin/ckb

In Windows, use cargo build --release instead and the executable is target/release/ckb.exe.