Obtaining and Compiling Source Code
This section describes how to compile 3FS on the Meta node.
- Set the library path.
export LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/local:/usr/lib:/usr/lib64:$LD_LIBRARY_PATH
- Download and compile 3FS.
yum install git -y cd /home git clone https://github.com/deepseek-ai/3fs cd 3fs git submodule update --init --recursive ./patches/apply.sh
- Download the patch (see Software Requirements) to the root directory of 3FS and apply the patch to 3FS.
patch -p1 < openeuler_3fs.patch cd third_party/folly patch -p1 < ../../openeuler_3fs_folly.patch
The patching is successful if the following information is displayed.

- Compile 3FS.
cd /home/3fs cmake -S . -B build -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON cmake --build build -j
- Check the compilation result.
cd build/bin ls

- Compile the USRBIO tool for fio tests on the native client.
- Pull fio code and compile it.
cd /home git clone https://github.com/axboe/fio.git cd fio ./configure make make install
- Go to the 3fs/benchmarks/fio_usrbio directory and perform compilation.
cd /home/3fs/benchmarks/fio_usrbio make HF3FS_LIB_DIR=${HF3FS_LIB_DIR} HF3FS_INCLUDE_DIR=${HF3FS_INCLUDE_DIR} FIO_SRC_DIR=${FIO_SRC_DIR}The following describes the involved path parameters:
- Replace paths in ${ } with actual paths, for example, HF3FS_LIB_DIR=/home/3fs/build/src/lib/api HF3FS_INCLUDE_DIR=/home/3fs/src/lib/api FIO_SRC_DIR=/home/fio.
- The default path of HF3FS_LIB_DIR is /home/3fs/build/src/lib/api.
- The default path of HF3FS_INCLUDE_DIR is /home/3fs/src/lib/api.
- The default path of FIO_SRC_DIR is the fio main directory (including the config-host.h file), for example, /home/fio.
After the compilation is complete, the hf3fs_usrbio.so file is generated in the /home/3fs/benchmarks/fio_usrbio directory.
- Pull fio code and compile it.
Parent topic: Compiling 3FS