《OceanBase开发者手册》之一 如何编译OceanBase源码

Abstract

本文将指导用户如何编译OceanBase, 本文大部分内容来自 https://github.com/oceanbase/oceanbase .

《OceanBase开发者手册》 主要指导开发者如何参与到OceanBase 的研发, 铺平参与OceanBase 开发的准备工作遇到的问题, 当前章节大概这几篇文章, 未来可能会增加部分文章, 目前OceanBase 源码参考OceanBase 开源官网的《开源数据库OceanBase源码解读》 系列 :

  1. 如何编译OceanBase源码
  2. 如何设置IDE开发环境
  3. 如何成为OceanBase Contributor
  4. 如何修改OceanBase文档
  5. 如何debug OceanBase
  6. 如何运行测试
  7. 如何修bug

步骤

OS compatibility list

OS Ver. Arch Compilable Package Deployable Compiled Binary Deployable Mysqltest Passed
Alibaba Cloud Linux 2.1903 x86_64
CentOS 7.2, 8.3 x86_64
Debian 9.8, 10.9 x86_64
Fedora 33 x86_64
MacOS any x86_64
openSUSE 15.2 x86_64
OpenAnolis 8.2 x86_64
SUSE 15.2 x86_64
Ubuntu 16.04, 18.04, 20.04 x86_64
UOS 20 x86_64

How to build

This document will show how to build oceanbase.

Preparation

Before building, you need to confirm that your device has installed the necessary software.

Redhat based (, including CentOS, Fedora, OpenAnolis, RedHat, UOS, etc.)

1
yum install git wget rpm* cpio make glibc-devel glibc-headers binutils

Debian based (, including Debian, Ubuntu, etc.)

1
apt-get install git wget rpm rpm2cpio cpio make build-essential binutils

SUSE based (, including SUSE, openSUSE, etc.)

1
zypper install git wget rpm cpio make glibc-devel binutils

debug mode

1
bash build.sh debug --init --make

release mode

1
bash build.sh release --init --make

RPM packages

1
bash build.sh rpm --init && cd build_rpm && make -j16 rpm