跳到主要内容

从源码构建

先跑起来

编译只是一半。先选一份 mudlib。语言模型:/llm(必须先问用哪份 lib,不要开 testsuite/)。

不要使用 v2017。 当前支持的是 master(CMake,C++17)。CYGWIN 与 32 位目标已不再支持。

支持的环境​

最佳平台:Ubuntu 22.04+(含 WSL)、最新 macOS(Intel 与 Apple Silicon)、Windows 上的 MSYS2/MINGW64。WebAssembly 见 构建 WebAssembly。

编译器: 至少 GCC 7+ 或 LLVM Clang 4+。

CI 覆盖的配置见仓库 .github/workflows/ci.yml:Ubuntu 24.04(GCC / Clang / 消毒器)、macOS 14、Windows MSYS2、Alpine 静态链接。

系统库(按需):ICU、jemalloc、OpenSSL、PCRE、MySQL 客户端、SQLite3、PostgreSQL、GoogleTest。捆绑的第三方库不必另装(libevent、libtelnet、libwebsockets 等)。

平台指南​

sudo apt update
sudo apt install -y build-essential autoconf automake bison expect \
libmysqlclient-dev libpcre2-dev libpq-dev libsqlite3-dev \
libssl-dev libtool libz-dev telnet libjemalloc-dev libicu-dev \
libgtest-dev pkg-config libffi-dev

git clone https://github.com/fluffos/fluffos.git
cd fluffos
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
make -j "$(nproc)" install

二进制在 build/bin/。WSL 下仓库必须在 Linux 文件系统(~/fluffos),不要 /mnt/c/...。

只需改 LPC 词法分析器(src/compiler/internal/lexer.l)时才需要 flex。

测试​

cd build
CTEST_OUTPUT_ON_FAILURE=1 make test

cd ../testsuite
../build/bin/driver etc/config.test -ftest

交互启动(得到提示符)见 从零到一个能连上的 MUD。失败见 排障。 完整 CMake 开关与包选项以英文 Build from Source 为准。