本文参考OceanBase提供的《从0到1 OceanBase原生分布式数据库内核实战基础版》,在ubuntu虚拟机上进行配置。
前言
使用 MiniOB 需要具备以下两个条件。
-
CMake:3.10 版本以上。
-
GCC/Clang:GCC 建议 8.3 版本以上,编译器需要支持 C++20 等新标准。
安装 CMake
wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.sh
bash cmake-3.24.0-linux-x86_64.sh
安装GCC
- 查看gcc版本
gcc --version
- 安装gcc(建议高于8.0)
sudo apt install gcc
构建 MiniOB
下载源码
git clone https://github.com/oceanbase/miniob.git
出现错误:
git clone https://github.com/oceanbase/miniob.git
正克隆到 'miniob'...
fatal: 无法访问 'https://github.com/oceanbase/miniob.git/':Failed to connect to github.com port 443 after 21122 ms: 拒绝连接
猜测原因:代理设置有问题,因此进行手动设置
git config --global http.proxy http://127.0.0.1:1080
git config --global http.proxy http://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
环境初始化
如果是第一次在当前环境上编译 MiniOB,需要执行如下命令安装 MiniOB 的依赖库。
cd miniob
bash build.sh init
问题:
可能会出现权限不够的问题
CMake Error at cmake_install.cmake:46 (file):
file cannot create directory: /usr/local/lib/pkgconfig. Maybe need
administrative privileges.
加上sudo即可
编译
debug版本
bash build.sh
release版本
bash build.sh release