3FS在ubuntu22.04下的编译(记录下编译过程,方便后续使用)
环境信息
- OS ubuntu 22.04
- 内核版本 6.8.0-52-generic
- libfuse 3.16.1
- rust 1.75.0
- FoundationDB 7.1.66
- meson 1.0.0
- ninja 1.10.1
libfuse编译
以下建议均在root下执行
bash
pip3 install pytest looseversion
wget https://github.com/libfuse/libfuse/releases/download/fuse-3.16.1/fuse-3.16.1.tar.gz
tar -xf fuse-3.16.1.tar.gz
cd fuse-3.16.1
mkdir build && cd build
meson setup ..
meson configure -D disable-mtab=true
ninja
python3 -m pytest test
ninja install
FoundationDB安装
bash
wget https://github.com/apple/foundationdb/releases/download/7.1.66/foundationdb-clients_7.1.66-1_amd64.deb
wget https://github.com/apple/foundationdb/releases/download/7.1.66/foundationdb-server_7.1.66-1_amd64.deb
dpkg -i foundationdb-clients_7.1.66-1_amd64.deb
dpkg -i foundationdb-server_7.1.66-1_amd64.deb
~/3fs main fdbcli ✔ 19:18:18
Using cluster file `/etc/foundationdb/fdb.cluster'.
The database is available.
Welcome to the fdbcli. For help, type `help'.
fdb>
3fs编译
- 依赖安装
bash
apt install cmake libuv1-dev liblz4-dev liblzma-dev libdouble-conversion-dev libdwarf-dev libunwind-dev \
libaio-dev libgflags-dev libgoogle-glog-dev libgtest-dev libgmock-dev clang-format-14 clang-14 clang-tidy-14 lld-14 \
libgoogle-perftools-dev google-perftools libssl-dev gcc-12 g++-12 libboost-all-dev libsnappy-dev libsodium-dev
- 编译第三方依赖
bash
git clone https://github.com/deepseek-ai/3fs
cd 3fs
git submodule update --init --recursive
./patches/apply.sh
# liburing编译
cd third_party/liburing
./configure --cc=gcc --cxx=g++;
make -j4
make install
# ztsd编译
cd third_party/zstd/
make
make install
# 开始编译3fs
cmake -S . -B build -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_C_COMPILER=clang-14 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build -j 8
如下所示即为编译成功