Getting Started
Supported Environment
The best platform to build FluffOS is ubuntu 22.04+ (including WSL), macOS latest (both Intel and Apple Silicon), and Windows on MSYS2/MINGW64.
Compilers: FluffOS uses C++17 and C11, which requires at least GCC 7+ or LLVM clang 4+.
Tested Configurations (validated by CI):
- Ubuntu 22.04: GCC and Clang with Debug/RelWithDebInfo builds
- macOS 14 (Apple Silicon): Clang with Debug/RelWithDebInfo builds
- Windows (MSYS2/MINGW64): GCC with Debug/RelWithDebInfo builds
- Alpine Linux 3.18: Static builds for Docker containers
System Library Requirements (Must install):
- ICU: FluffOS uses ICU for UTF-8 and transcoding support.
- jemalloc: Release build use JEMALLOC by default, and is highly recommended in production.
- OpenSSL (if PACKAGE_CRYPTO enabled) - Note: typically disabled on Windows
- PCRE (if PACKAGE_PCRE enabled)
- MysqlClient (if PACKAGE_DB enabled with MySQL support)
- SQLite3 (if PACKAGE_DB_SQLITE enabled)
- PostgreSQL (if PACKAGE_DB enabled with PostgreSQL support)
- GoogleTest (for running unit tests)
Bundled thirdparty library (no need to install):
- Libevent 2.0+.
- libtelnet: telnet protocol support
- libwebsocket: websocket support.
- ghc filesystem: polyfill for std::filesystem
- backward-cpp: stacktrace
- utf8_decoder_dfa: fast utf8 validation.
- widecharwidth: wcwidth with unicode 11
Ubuntu LTS
This is the best linux distro to build & run FluffOS, support for other distro is best effort only.
Installing Dependencies
$ sudo apt update
$ sudo apt install -y build-essential autoconf automake bison expect \
libmysqlclient-dev libpcre3-dev libpq-dev libsqlite3-dev \
libssl-dev libtool libz-dev telnet libjemalloc-dev libicu-dev \
libgtest-devFor sanitizer builds (memory debugging), also install:
$ sudo apt install -y libdw-dev libbz2-devCheckout Git Repo
$ git clone https://github.com/fluffos/fluffos.git
$ cd fluffos
$ git checkout master # or a release tag like v2019Ensure CMake 3.22+
FluffOS requires CMake 3.22 or higher. Ubuntu 22.04+ includes this by default. If needed:
$ sudo apt install cmake # or
$ sudo pip install --upgrade cmakeBuild (Standard)
$ mkdir build && cd build
$ cmake ..
$ make -j $(nproc) installBinary files and support files will be in ./bin/
Build Types
Debug Build (for development):
$ cmake -DCMAKE_BUILD_TYPE=Debug -DPACKAGE_DB_SQLITE=2 ..
$ make -j $(nproc) installRelease Build with Info (recommended for testing):
$ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPACKAGE_DB_SQLITE=2 ..
$ make -j $(nproc) installSanitizer Build (for memory debugging):
$ export CC=clang CXX=clang++
$ cmake -DCMAKE_BUILD_TYPE=Debug -DPACKAGE_DB_SQLITE=2 -DENABLE_SANITIZER=ON ..
$ make -j $(nproc) installRunning Tests
After building, run the test suite:
# Unit tests
$ cd build
$ make test
# or with verbose output
$ CTEST_OUTPUT_ON_FAILURE=1 make test
# LPC testsuite
$ cd testsuite
$ ../build/bin/driver etc/config.test -ftestMacOS
Requires macOS 10.15+. Tested on macOS 14 (both Intel and Apple Silicon).
Install Homebrew
If not already installed, goto https://brew.sh/ and follow instructions!
Install Dependencies
$ brew install cmake pkg-config mysql pcre libgcrypt openssl jemalloc icu4c \
sqlite3 googletestSet HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 to speed up brew installs if needed.
Build
You need to pass environment variables for OpenSSL and ICU locations:
Modern Homebrew (recommended):
$ mkdir build && cd build
$ OPENSSL_ROOT_DIR="/usr/local/opt/openssl" ICU_ROOT="/opt/homebrew/opt/icu4c" \
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPACKAGE_DB_SQLITE=2 ..
$ make -j $(sysctl -n hw.ncpu) installThis works for both Apple Silicon and Intel Macs with recent Homebrew installations.
Older Homebrew installations (if you get ICU-related errors):
$ mkdir build && cd build
$ OPENSSL_ROOT_DIR="/usr/local/opt/openssl" ICU_ROOT="/usr/local/opt/icu4c" \
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPACKAGE_DB_SQLITE=2 ..
$ make -j $(sysctl -n hw.ncpu) installRunning Tests
# Unit tests
$ cd build
$ CTEST_OUTPUT_ON_FAILURE=1 make test
# LPC testsuite
$ cd testsuite
$ ../build/bin/driver etc/config.test -ftestNote: If you encounter issues, check the latest CI configuration at: https://github.com/fluffos/fluffos/blob/master/.github/workflows/ci-osx.yml
Windows
Supported Environment: Windows 10+ with MSYS2/MINGW64. Binary produced can run on Windows 7+.
Note: FluffOS LPC VM is always 64-bit! You can't use more than 4GB memory in 32-bit builds.
For the most up-to-date commands, check: https://github.com/fluffos/fluffos/blob/master/.github/workflows/ci-windows.yml
Install MSYS2
- Download MSYS2 from the official website: https://www.msys2.org/
- Pick the X86_64 version for 64-bit Windows
Update MSYS2
Open msys2.exe and sync/update MSYS2:
$ pacman -SyuYou may need to close and reopen the MSYS2 window. Keep running the update command until there's nothing left to upgrade.
Install Build Dependencies
$ pacman --noconfirm -S --needed \
git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake \
mingw-w64-x86_64-zlib mingw-w64-x86_64-pcre \
mingw-w64-x86_64-icu mingw-w64-x86_64-sqlite3 \
mingw-w64-x86_64-jemalloc mingw-w64-x86_64-gtest \
bison makeOptional: For MySQL/MariaDB support:
$ pacman -S mingw-w64-x86_64-libmariadbclient:::important CRITICAL: After installation, close the MSYS2 window and open MINGW64.exe instead! All build commands must run in the MINGW64 shell. :::
Build
In the MINGW64 shell:
$ git clone https://github.com/fluffos/fluffos.git
$ cd fluffos
$ mkdir build && cd build
$ cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug \
-DMARCH_NATIVE=OFF -DPACKAGE_CRYPTO=OFF \
-DPACKAGE_DB_MYSQL="" -DPACKAGE_DB_SQLITE=1 ..
$ make -j $(nproc) installNotes:
-DMARCH_NATIVE=OFF: Ensures portability across different CPUs-DPACKAGE_CRYPTO=OFF: Crypto package is typically disabled on Windows-DPACKAGE_DB_SQLITE=1: Enable SQLite (set to 2 for version 2)-DPACKAGE_DB_MYSQL="": Disable MySQL (or set to enable)
Running Tests
# Unit tests
$ cd build
$ CTEST_OUTPUT_ON_FAILURE=1 make test
# LPC testsuite
$ cd testsuite
$ ../build/bin/driver etc/config.test -ftestBuild Configuration Options
Packages
By default, the driver has a default list of builtin packages to build.
To disable specific packages:
$ cmake .. -DPACKAGE_CRYPTO=OFF -DPACKAGE_DB=OFFCommon package options:
PACKAGE_DB_SQLITE=1or=2: Enable SQLite support=1enables SQLite3 API version 1=2enables SQLite3 API version 2 (recommended, includes newer features)
PACKAGE_DB_MYSQL="": Disable MySQL (or set to enable)PACKAGE_CRYPTO=OFF: Disable crypto package (typical on Windows)PACKAGE_PCRE=OFF: Disable PCRE package
Build Types
FluffOS supports standard CMake build types:
- Debug: No optimization, full debug symbols (
-DCMAKE_BUILD_TYPE=Debug) - Release: Full optimization, no debug symbols (
-DCMAKE_BUILD_TYPE=Release) - RelWithDebInfo: Optimized with debug symbols (
-DCMAKE_BUILD_TYPE=RelWithDebInfo) - recommended for testing
CPU Compatibility
By default, driver built in release mode will optimize for the current system CPU only using -march=native. Copying the driver to another machine with a different CPU may not work!
If you need portable drivers, turn off MARCH_NATIVE:
$ cmake .. -DMARCH_NATIVE=OFFThis is automatically disabled in CI for Windows, Docker, and when building for distribution.
Static Linking
You can force static linking for all libraries:
$ cmake .. -DSTATIC=ONNote: This only works in specialized environments like Alpine Linux and Windows/MSYS2.
Sanitizer Builds
Enable AddressSanitizer for memory debugging:
$ cmake .. -DENABLE_SANITIZER=ONRequirements:
- Use Clang compiler (recommended)
- Install additional dependencies on Ubuntu:
libdw-dev libbz2-dev - Build in Debug or RelWithDebInfo mode
Testing
Unit Tests
FluffOS includes C++ unit tests using GoogleTest:
$ cd build
$ make test
# or with verbose output
$ CTEST_OUTPUT_ON_FAILURE=1 make testLPC Testsuite
The LPC testsuite tests the driver with actual LPC code:
$ cd testsuite
$ ../build/bin/driver etc/config.test -ftestContinuous Integration
FluffOS uses GitHub Actions for automated testing on every push and pull request:
- Ubuntu CI: Tests with GCC and Clang on ubuntu-22.04
- macOS CI: Tests on macOS 14 (Apple Silicon)
- Windows CI: Tests with MSYS2/MINGW64
- Sanitizer CI: Memory safety checks with Clang + AddressSanitizer
- CodeQL: Security vulnerability scanning
- Coverity Scan: Static analysis (weekly)
All CI workflows run both unit tests and the LPC testsuite.
See .github/workflows/ for the exact CI configuration.
Alpine Linux & Docker
Alpine Linux is used for building static binaries suitable for Docker containers. The Docker image is based on Alpine 3.18.
Installing Dependencies
# Install all libs
$ apk add --no-cache linux-headers gcc g++ clang-dev make cmake bash \
mariadb-dev mariadb-static postgresql-dev sqlite-dev sqlite-static \
openssl-dev openssl-libs-static zlib-dev zlib-static icu-dev icu-static \
pcre-dev bison git musl-dev libelf-static elfutils-dev \
zstd-static bzip2-static xz-staticInstalling jemalloc
Jemalloc must be installed manually on Alpine:
$ wget -O - https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 | tar -xj
$ cd jemalloc-5.3.0
$ ./configure --prefix=/usr
$ make && make installBuild Steps
$ git clone https://github.com/fluffos/fluffos.git
$ cd fluffos
$ mkdir build && cd build
$ cmake .. -DMARCH_NATIVE=OFF -DSTATIC=ON
$ make installVerify Static Binary
Check that the result is a static executable:
$ ldd bin/driver
not a dynamic executableUsing Docker
FluffOS provides an official Docker image built automatically on every push to master:
Pull and run the official image:
$ docker pull ghcr.io/fluffos/fluffos:master
$ docker run -it ghcr.io/fluffos/fluffos:master /path/to/config.cfgBuild your own Docker image:
$ docker build -t fluffos:local .
$ docker run -it fluffos:local /path/to/config.cfgThe Dockerfile uses a multi-stage build:
- Builder stage: Compiles FluffOS statically on Alpine 3.18
- Runtime stage: Creates minimal image with just the binary
See the Dockerfile in the repository root for details.