aboutsummaryrefslogtreecommitdiffstats
path: root/BUILD.md
blob: 9716431ff6a0dfbcd1cea4d74f49e1504e0ac833 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## Building YDB from sources

#### Build Requirements
 We have tested YDB builds using Ubuntu 18.04 and Ubuntu 20.04. Other Linux distributions are likely to work, but additional effort may be needed. Only x86_64 Linux is currently supported.

 Below is a list of packages that need to be installed before building YDB. 'How to Build' section contains step by step instructions to obtain these packages.

 - cmake 3.22+
 - clang-12
 - lld-12
 - git 2.20+
 - python2.7
 - python3.8
 - pip3
 - antlr3
 - libaio-dev
 - libidn11-dev
 - ninja 1.10+

 We run multiple clang instances in parallel to speed up the process by default. Each instance of clang may use up to 1GB of RAM, and linking the binary may use up to 16GB of RAM, please make sure your build host has enough resources.

#### Runtime Requirements
 The following packages are required to run ydbd server:

 - libidn11
 - libaio

#### How to Build

1. Add repositories for dependencies

    Note: the following repositories are required for **Ubuntu 20.04**. You may skip this step if your GNU/Linux distribution has all required packages in their default repository.
    For more information please read your distribution documentation and https://apt.llvm.org as well as https://apt.kitware.com/
     ```
    wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
    wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo apt-key add -
    echo 'deb http://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
    echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal main' | sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null

    sudo apt-get update
     ```

1. Install dependencies

    ```
    sudo apt-get -y install git cmake python python3-pip ninja-build antlr3 m4 clang-12 lld-12 libidn11-dev libaio1 libaio-dev
    sudo pip3 install conan
     ```

 1. Create the work directory. Please make sure you have at least 80Gb of free space. We also recommend placing this directory on SSD to reduce build times.
    ```
    mkdir ~/ydbwork && cd ~/ydbwork
    mkdir build
    ```

 1. Clone the ydb repository.
    ```
    git clone https://github.com/ydb-platform/ydb.git
    ```

 1. Build ydb
     ```
    cd build
    cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../ydb/clang.toolchain ../ydb
    ninja
    ```
    A YDB server binary can be found at:
    ```
    ydb/apps/ydbd/ydbd
    ```
    A YDB CLI binary can be found at:
    ```
    ydb/apps/ydb/ydb
    ```